| Total Complexity | 1 |
| Complexity/F | 1 |
| Lines of Code | 16 |
| Function Count | 1 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | const Stack = require('./index.js'); |
||
| 2 | // put your tests here |
||
| 3 | test('test stack', () => { |
||
| 4 | let stack = new Stack(); |
||
| 5 | stack.push(1); |
||
| 6 | expect(stack.top()).toEqual(1); |
||
| 7 | stack.push(2); |
||
| 8 | stack.push(3); |
||
| 9 | expect(stack.isEmpty()).toEqual(false); |
||
| 10 | expect(stack.top()).toEqual(3); |
||
| 11 | expect(stack.pop()).toEqual(3); |
||
| 12 | expect(stack.pop()).toEqual(2); |
||
| 13 | expect(stack.pop()).toEqual(1); |
||
| 14 | expect(stack.pop()).toEqual(undefined); |
||
| 15 | expect(stack.isEmpty()).toEqual(true); |
||
| 16 | }); |
||
| 17 |