-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.test.ts
More file actions
32 lines (31 loc) · 933 Bytes
/
Copy pathindex.test.ts
File metadata and controls
32 lines (31 loc) · 933 Bytes
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
import { resize } from '.';
const { resized } = resize.actions;
describe('resize', () => {
describe('when window is defined', () => {
const store = resize.initialize({ window }).asStore({
deferred: true,
enforceImmutableState: true,
});
beforeEach(() => {
store.reload();
});
it('updates the dimensions state when resized', () => {
store.dispatch(resized(1, 2));
expect(store.getState().resize.height).toBe(1);
expect(store.getState().resize.width).toBe(2);
});
});
describe('when window is undefined', () => {
const store = resize.initialize({ window: 'none' }).asStore({
deferred: true,
enforceImmutableState: true,
});
beforeEach(() => {
store.reload();
});
it('initializes the size to 0,0', () => {
expect(store.getState().resize.height).toBe(0);
expect(store.getState().resize.width).toBe(0);
});
});
});