-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathwindow-size.test.js
55 lines (53 loc) · 1.26 KB
/
window-size.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
jest.mock('window-size', () => ({
get: jest
.fn()
.mockReturnValueOnce({
width: 40,
height: 100,
})
.mockReturnValueOnce()
.mockReturnValueOnce({ height: 250 })
.mockReturnValueOnce({ width: 50 })
.mockReturnValueOnce({
width: 80,
height: 300,
}),
}));
const getWindowSize = require('../src/create-twilio-function/window-size');
describe('getWindowSize', () => {
it('gets a valid windowSize', () => {
const windowSize = getWindowSize();
expect(windowSize).toEqual({
width: 40,
height: 100,
});
});
it('cannot get a null windowSize', () => {
const windowSize = getWindowSize();
expect(windowSize).toEqual({
width: 80,
height: 300,
});
});
it('gets a windowSize without a width', () => {
const windowSize = getWindowSize();
expect(windowSize).toEqual({
width: 80,
height: 250,
});
});
it('gets a windowSize without a height', () => {
const windowSize = getWindowSize();
expect(windowSize).toEqual({
width: 50,
height: 300,
});
});
it('gets a windowSize without a width nor a height', () => {
const windowSize = getWindowSize();
expect(windowSize).toEqual({
width: 80,
height: 300,
});
});
});