Skip to content

Commit 79dfdbd

Browse files
add activedTabsHistory.test.js
1 parent 1b21944 commit 79dfdbd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import SelectedTabsHistory from './activedTabsHistory.js';
2+
let obj = null;
3+
beforeEach(() => {
4+
obj = new SelectedTabsHistory();
5+
});
6+
afterEach(() => {
7+
obj = null;
8+
});
9+
describe('SelectedTabsHistory.prototype.remove : ', () => {
10+
test('it should remove all occurrences of an element in the array', () => {
11+
obj.tabsId = ['1', '2', '1', '3', '4', '2', '6'];
12+
obj.remove('1').remove('2');
13+
expect(obj.tabsId.indexOf('1')).toBe(-1);
14+
expect(obj.tabsId.indexOf('2')).toBe(-1);
15+
});
16+
test('it should not work with number as a parameter', () => {
17+
obj.tabsId = ['1', '2', '1', '3', '4', '2', '6'];
18+
obj.remove(1);
19+
expect(obj.tabsId.indexOf('1')).toBe(0);
20+
});
21+
});

0 commit comments

Comments
 (0)