MCPcopy
hub / github.com/tinyhttp/tinyhttp / InitAppAndTestUnless

Function InitAppAndTestUnless

__tests__/wares/unless.test.ts:12–24  ·  view source on GitHub ↗
(options: UnlessMiddlewareOptions | CustomUnless)

Source from the content-addressed store, hash-verified

10}
11
12function InitAppAndTestUnless(options: UnlessMiddlewareOptions | CustomUnless) {
13 const app = createServer((req, res) => {
14 unless({ handler: exampleMiddleware, type: 'mw' }, options)(req as Request, res as Response, () => {
15 return
16 })
17 res.statusCode = 200
18 res.end()
19 })
20
21 const fetch = makeFetch(app)
22
23 return fetch
24}
25
26describe('Unless Middleware path parameter test', () => {
27 it("should execute if path string doesn't match", async () => {

Callers 1

unless.test.tsFile · 0.85

Calls 2

unlessFunction · 0.90
createServerFunction · 0.70

Tested by

no test coverage detected