src/__tests__/setup.js   A
last analyzed

Complexity

Total Complexity 5
Complexity/F 1

Size

Lines of Code 33
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 20
mnd 0
bc 0
fnc 5
dl 0
loc 33
rs 10
bpm 0
cpm 1
noi 4
c 0
b 0
f 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