[go: up one dir, main page]

Skip to content

Commit

Permalink
fix(curriculum): add element to create-a-stack tests (freeCodeCamp#42326
Browse files Browse the repository at this point in the history
)

* Adding more than one stack item to the stack tests for freeCodeCamp#42322

* fix(curriculum): improved peek, pop and clear tests

tests that peek does not remove top element and pop does remove top element and addded an element to the stack for the clear test
  • Loading branch information
nayanadasgupta committed Jun 3, 2021
1 parent f559f18 commit f5eb0d5
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ The `peek` method should return the top element of the stack
assert(
(function () {
var test = new Stack();
test.push('CS61');
test.push('CS50');
return test.peek() === 'CS50';
return test.peek() === 'CS50' && test.peek() === 'CS50';
})()
);
```
Expand All @@ -89,8 +90,9 @@ The `pop` method should remove and return the top element of the stack
assert(
(function () {
var test = new Stack();
test.push('CS61');
test.push('CS50');
return test.pop() === 'CS50';
return test.pop() === 'CS50' && test.pop() === 'CS61';
})()
);
```
Expand All @@ -112,6 +114,7 @@ The `clear` method should remove all element from the stack
assert(
(function () {
var test = new Stack();
test.push('CS61');
test.push('CS50');
test.clear();
return test.isEmpty();
Expand Down

0 comments on commit f5eb0d5

Please sign in to comment.