-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.test.js
38 lines (32 loc) · 986 Bytes
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const formatter = require('./index');
const header = require('./src/header');
const body = require('./src/body');
const hasBody = require('./src/hasBody');
describe('formatter', () => {
it('has expected functions', () => {
expect(formatter.header).toBe(header);
expect(formatter.hasBody).toBe(hasBody);
expect(formatter.body).toBe(body);
})
});
describe('.install', () => {
afterEach(() => {
delete global.devtoolsFormatters;
});
it('setup formatter as expected', () => {
formatter.install();
expect(global.devtoolsFormatters).toEqual([formatter]);
// only set it up once
formatter.install();
expect(global.devtoolsFormatters).toEqual([formatter]);
})
describe('.uninstall', () => {
it('removes formatter as expected', () => {
formatter.uninstall();
expect(global.devtoolsFormatters).toEqual([]);
// idempotent
formatter.uninstall();
expect(global.devtoolsFormatters).toEqual([]);
})
})
})