-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
Signed-off-by: Matteo Collina <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict' | ||
|
||
const { describe, it, before } = require('node:test') | ||
const assert = require('node:assert') | ||
const Fastify = require('fastify') | ||
const asyncforge = require('../') | ||
|
||
describe('support exiting from a context', () => { | ||
let fastify | ||
before(async () => { | ||
fastify = Fastify() | ||
await fastify.register(asyncforge) | ||
}) | ||
|
||
it('throws', () => { | ||
assert.throws(asyncforge.app) | ||
}) | ||
|
||
it('does not throw using enterWith', () => { | ||
fastify.enterWith() | ||
Check failure on line 20 in test/before.test.js GitHub Actions / test (18.x)does not throw using enterWith
Check failure on line 20 in test/before.test.js GitHub Actions / test (20.x)does not throw using enterWith
Check failure on line 20 in test/before.test.js GitHub Actions / test (18.x)does not throw using enterWith
Check failure on line 20 in test/before.test.js GitHub Actions / test (20.x)does not throw using enterWith
|
||
assert.equal(asyncforge.app(), fastify) | ||
}) | ||
}) | ||
|
||
describe('enterWith in before', () => { | ||
let fastify | ||
before(async () => { | ||
fastify = Fastify() | ||
await fastify.register(asyncforge) | ||
fastify.enterWith() | ||
Check failure on line 30 in test/before.test.js GitHub Actions / test (18.x)enterWith in before
Check failure on line 30 in test/before.test.js GitHub Actions / test (20.x)enterWith in before
Check failure on line 30 in test/before.test.js GitHub Actions / test (18.x)enterWith in before
Check failure on line 30 in test/before.test.js GitHub Actions / test (20.x)enterWith in before
|
||
}) | ||
|
||
it('throws', () => { | ||
Check failure on line 33 in test/before.test.js GitHub Actions / test (18.x)throws
Check failure on line 33 in test/before.test.js GitHub Actions / test (20.x)throws
Check failure on line 33 in test/before.test.js GitHub Actions / test (18.x)throws
Check failure on line 33 in test/before.test.js GitHub Actions / test (20.x)throws
|
||
assert.throws(asyncforge.app) | ||
}) | ||
|
||
it('does not throw using enterWith again', () => { | ||
Check failure on line 37 in test/before.test.js GitHub Actions / test (18.x)does not throw using enterWith again
Check failure on line 37 in test/before.test.js GitHub Actions / test (20.x)does not throw using enterWith again
Check failure on line 37 in test/before.test.js GitHub Actions / test (18.x)does not throw using enterWith again
Check failure on line 37 in test/before.test.js GitHub Actions / test (20.x)does not throw using enterWith again
|
||
fastify.enterWith() | ||
assert.equal(asyncforge.app(), fastify) | ||
}) | ||
}) |