Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Commit a538507

Browse files
committed
Added tests for boost.js
1 parent 977288f commit a538507

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/lib/test/unit/boost.spec.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import getBoosts from '../../boost'
2+
3+
describe('getBoosts method', () => {
4+
describe('with empty boost config', () => {
5+
beforeEach(() => {
6+
jest.mock('config', () => ({}))
7+
})
8+
9+
it('Should return 1', () => {
10+
const result = getBoosts('color');
11+
expect(result).toEqual(1);
12+
});
13+
})
14+
15+
describe('with boost config', () => {
16+
beforeEach(() => {
17+
jest.mock('config', () => ({
18+
boost: {
19+
name: 3
20+
}
21+
}))
22+
})
23+
24+
it('color not in config and should be 1', () => {
25+
const result = getBoosts('color');
26+
expect(result).toEqual(1);
27+
});
28+
29+
it('name is in config and should be 3', () => {
30+
const result = getBoosts('name');
31+
expect(result).toEqual(3);
32+
});
33+
})
34+
})

0 commit comments

Comments
 (0)