Passed
Push — master ( 9157a5...293fbd )
by Zhenyu
01:50
created

setup.js ➔ ... ➔ ???   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 6
Bugs 0 Features 6
Metric Value
cc 1
eloc 3
c 6
b 0
f 6
nc 1
dl 0
loc 3
rs 10
nop 0
1
import * as nAutoMetrics from '@financial-times/n-auto-metrics';
2
import * as nAutoLogger from '@financial-times/n-auto-logger';
3
4
import setupMonitor from '../setup';
5
6
jest.mock('@financial-times/n-auto-metrics');
0 ignored issues
show
Bug introduced by
The variable jest seems to be never declared. If this is a global, consider adding a /** global: jest */ comment.

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.

Loading history...
7
jest.mock('@financial-times/n-auto-logger');
8
9
describe('setupMonitor', () => {
10
	afterEach(() => {
11
		jest.resetAllMocks();
0 ignored issues
show
Bug introduced by
The variable jest seems to be never declared. If this is a global, consider adding a /** global: jest */ comment.

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.

Loading history...
12
	});
13
14
	afterAll(() => {
15
		jest.resetModules();
0 ignored issues
show
Bug introduced by
The variable jest seems to be never declared. If this is a global, consider adding a /** global: jest */ comment.

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.

Loading history...
16
	});
17
18
	const app = {
19
		use: jest.fn(),
0 ignored issues
show
Bug introduced by
The variable jest seems to be never declared. If this is a global, consider adding a /** global: jest */ comment.

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.

Loading history...
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