Skip to content

Commit afa25e4

Browse files
committed
Update node and test setup.
1 parent 6bff79d commit afa25e4

File tree

3 files changed

+38
-32
lines changed

3 files changed

+38
-32
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Node.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
export default class Node {}
1+
export default class Node {
2+
private value: any;
3+
4+
constructor(value: any = null) {
5+
this.value = value;
6+
}
7+
}

tests/Stack.test.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,33 @@ describe("Stack", () => {
1616
expect(stack.isEmpty()).toBeTruthy()
1717
});
1818

19-
test("push() should add a node", () => {
20-
let node: Node = new Node();
21-
stack.push(node);
22-
expect(stack.isEmpty()).toBeFalsy();
23-
});
24-
25-
test("count() should count its nodes", () => {
26-
let node: Node = new Node();
27-
stack.push(node);
28-
stack.push(node);
29-
expect(stack.count()).toEqual(2);
30-
});
31-
32-
test("pop() should remove the last node added", () => {
33-
let node1: Node = new Node();
34-
let node2: Node = new Node();
35-
stack.push(node1);
36-
stack.push(node2);
37-
let lastNode = stack.pop();
38-
expect(lastNode).toEqual(node2);
39-
});
40-
41-
test("peek() should return the top node", () => {
42-
let node1: Node = new Node();
43-
let node2: Node = new Node();
44-
stack.push(node1);
45-
stack.push(node2);
46-
expect(stack.peek()).toEqual(node2);
47-
});
48-
})
19+
// test("push() should add a node", () => {
20+
// let node: Node = new Node();
21+
// stack.push(node);
22+
// expect(stack.isEmpty()).toBeFalsy();
23+
// });
24+
//
25+
// test("count() should count its nodes", () => {
26+
// let node: Node = new Node();
27+
// stack.push(node);
28+
// stack.push(node);
29+
// expect(stack.count()).toEqual(2);
30+
// });
31+
//
32+
// test("pop() should remove the last node added", () => {
33+
// let node1: Node = new Node();
34+
// let node2: Node = new Node();
35+
// stack.push(node1);
36+
// stack.push(node2);
37+
// let lastNode = stack.pop();
38+
// expect(lastNode).toEqual(node2);
39+
// });
40+
//
41+
// test("peek() should return the top node", () => {
42+
// let node1: Node = new Node();
43+
// let node2: Node = new Node();
44+
// stack.push(node1);
45+
// stack.push(node2);
46+
// expect(stack.peek()).toEqual(node2);
47+
// });
48+
})

0 commit comments

Comments
 (0)