-
Notifications
You must be signed in to change notification settings - Fork 539
/
Copy pathresetPage.js
33 lines (24 loc) · 1012 Bytes
/
resetPage.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
'use strict';
const SearchParameters = require('../../../src/SearchParameters');
test('without a previous page it should return the given SearchParameters', () => {
const parameters = new SearchParameters();
const parametersWithPageReseted = parameters.resetPage();
expect(parameters).toBe(parametersWithPageReseted);
expect(parametersWithPageReseted.page).toBeUndefined();
});
test('with a previous page of 0 it should return the given SearchParameters', () => {
const parameters = new SearchParameters({
page: 0,
});
const parametersWithPageReseted = parameters.resetPage();
expect(parameters).toBe(parametersWithPageReseted);
expect(parametersWithPageReseted.page).toBe(0);
});
test('with a previous page it should set the page to 0', () => {
const parameters = new SearchParameters({
page: 5,
});
const parametersWithPageReseted = parameters.resetPage();
expect(parameters).not.toBe(parametersWithPageReseted);
expect(parametersWithPageReseted.page).toBe(0);
});