MCPcopy Index your code
hub / github.com/freeCodeCamp/freeCodeCamp / setupServer

Function setupServer

api/src/plugins/bouncer.test.ts:22–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20let authorizeSpy: MockInstance<FastifyInstance['authorize']>;
21
22async function setupServer() {
23 const fastify = Fastify();
24 await fastify.register(cookies);
25 await fastify.register(auth);
26 authorizeSpy = vi.spyOn(fastify, 'authorize');
27
28 await fastify.register(redirectWithMessage);
29 await fastify.register(bouncer);
30 fastify.addHook('onRequest', fastify.authorize);
31 fastify.get('/', (_req, reply) => {
32 void reply.send({ foo: 'bar' });
33 });
34 return fastify;
35}
36
37describe('bouncer', () => {
38 let fastify: FastifyInstance;

Callers 1

bouncer.test.tsFile · 0.70

Calls 1

sendMethod · 0.45

Tested by

no test coverage detected