From f5eb0d55fbcf5b9b2609673dcc1e5ba438043cc7 Mon Sep 17 00:00:00 2001 From: nayanadasgupta <43610663+nayanadasgupta@users.noreply.github.com> Date: Thu, 3 Jun 2021 08:01:34 +0100 Subject: [PATCH] fix(curriculum): add element to create-a-stack tests (#42326) * Adding more than one stack item to the stack tests for #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 --- .../data-structures/create-a-stack-class.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/curriculum/challenges/english/10-coding-interview-prep/data-structures/create-a-stack-class.md b/curriculum/challenges/english/10-coding-interview-prep/data-structures/create-a-stack-class.md index a26dec74f6..c4a493c439 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/data-structures/create-a-stack-class.md +++ b/curriculum/challenges/english/10-coding-interview-prep/data-structures/create-a-stack-class.md @@ -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'; })() ); ``` @@ -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'; })() ); ``` @@ -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();