| Conditions | 1 |
| Paths | 1 |
| Total Lines | 35 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | import * as nAutoMetrics from '@financial-times/n-auto-metrics'; |
||
| 9 | describe('setupMonitor', () => { |
||
| 10 | afterEach(() => { |
||
| 11 | jest.resetAllMocks(); |
||
| 12 | }); |
||
| 13 | |||
| 14 | afterAll(() => { |
||
| 15 | jest.resetModules(); |
||
| 16 | }); |
||
| 17 | |||
| 18 | const app = { |
||
| 19 | use: jest.fn(), |
||
| 20 | }; |
||
| 21 | const metrics = {}; |
||
| 22 | const logger = {}; |
||
| 23 | |||
| 24 | it('initAutoMetrics if metrics instance is provided', () => { |
||
| 25 | setupMonitor({ app, metrics }); |
||
| 26 | expect(nAutoMetrics.initAutoMetrics).toBeCalledWith(metrics); |
||
| 27 | }); |
||
| 28 | |||
| 29 | it('setupLoggerInstance to override the default if logger is provided', () => { |
||
| 30 | setupMonitor({ app, logger }); |
||
| 31 | expect(nAutoLogger.setupLoggerInstance).toBeCalledWith(logger); |
||
| 32 | }); |
||
| 33 | |||
| 34 | it('do include enhancedRender middleware with autoNext default to true', () => { |
||
| 35 | setupMonitor({ app }); |
||
| 36 | expect(app.use.mock.calls).toMatchSnapshot(); |
||
| 37 | }); |
||
| 38 | |||
| 39 | it('do not include enhancedRender middleware is autoNext disabled', () => { |
||
| 40 | setupMonitor({ app, autoNext: false }); |
||
| 41 | expect(app.use.mock.calls).toMatchSnapshot(); |
||
| 42 | }); |
||
| 43 | }); |
||
| 44 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.