@whook/whook
Version:
Build strong and efficient REST web services.
56 lines • 1.47 kB
JavaScript
/* eslint-disable @typescript-eslint/no-explicit-any */
import { describe, test, beforeEach, jest, expect } from '@jest/globals';
import initRoutesWrappers from './ROUTES_WRAPPERS.js';
import { identity } from '../libs/utils.js';
describe('initRoutesWrappers', () => {
const log = jest.fn();
beforeEach(() => {
log.mockReset();
});
describe('should work', () => {
test('without wrappers', async () => {
const ROUTES_WRAPPERS = await initRoutesWrappers({
ROUTES_WRAPPERS_NAMES: [],
log,
});
expect({
ROUTES_WRAPPERS,
logCalls: log.mock.calls,
}).toMatchInlineSnapshot(`
{
"ROUTES_WRAPPERS": [],
"logCalls": [
[
"warning",
"🏭 - Initializing the ROUTES_WRAPPERS service.",
],
],
}
`);
});
test('with wrappers', async () => {
const ROUTES_WRAPPERS = await initRoutesWrappers({
ROUTES_WRAPPERS_NAMES: ['aWrapper'],
log,
aWrapper: identity,
});
expect({
ROUTES_WRAPPERS,
logCalls: log.mock.calls,
}).toMatchInlineSnapshot(`
{
"ROUTES_WRAPPERS": [
[Function],
],
"logCalls": [
[
"warning",
"🏭 - Initializing the ROUTES_WRAPPERS service.",
],
],
}
`);
});
});
});
//# sourceMappingURL=ROUTES_WRAPPERS.test.js.map