-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
33 additions
and
34 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ | |
* the LIFO (Last In, First Out) principle. | ||
*/ | ||
class Stack { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import Stack from "../stack.mjs" | ||
import { expect } from "chai" | ||
|
||
describe("Stack", function () { | ||
//Satisfy these tests in order | ||
it("is initially empty", function () { | ||
const stack = new Stack(); | ||
expect(stack.top).to.equal(-1); | ||
}); | ||
|
||
it("pushes to the top", function () { | ||
const stack = new Stack(); | ||
stack.push(5); | ||
expect(stack.top).to.equal(5); | ||
stack.push("test"); | ||
expect(stack.top).to.equal("test"); | ||
}); | ||
|
||
it("pops from the top", function () { | ||
const stack = new Stack(); | ||
stack.push(5); | ||
stack.push("test"); | ||
let top = stack.pop(); | ||
expect(top).to.equal("test") | ||
}); | ||
|
||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.