-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack.test.js
More file actions
50 lines (45 loc) · 1.13 KB
/
stack.test.js
File metadata and controls
50 lines (45 loc) · 1.13 KB
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
// npm test -- stack.test
const Stack = require("./stack");
test("Creates Appropriate Stack", () => {
let myStack = new Stack();
const input = myStack.stack;
const output = [];
expect(input).toEqual(output);
});
test("Can Push items", () => {
let myStack = new Stack();
myStack.push(1);
debugger;
const input = myStack.stack;
const output = [1];
expect(input).toEqual(output);
});
test("Can Push many items", () => {
let myStack = new Stack();
myStack.push(1);
myStack.push(2);
myStack.push(3);
myStack.push(4);
const input = myStack.stack;
const output = [1, 2, 3, 4];
expect(input).toEqual(output);
});
test("Can Pop last item", () => {
let myStack = new Stack();
myStack.push(1);
myStack.push(2);
myStack.push(3);
myStack.pop();
const input = myStack.stack;
const output = [1, 2];
expect(input).toEqual(output);
});
test("Can Peek at last item", () => {
let myStack = new Stack();
myStack.push(1);
myStack.push(2);
myStack.push(3);
const input = myStack.peek();
const output = 3;
expect(input).toBe(output);
});