-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from tlehwalder/birthday-cake-candles
Adds test coverage for Birthday Cake Candles
- Loading branch information
Showing
2 changed files
with
39 additions
and
13 deletions.
There are no files selected for viewing
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 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 @@ | ||
const birthdayCakeCandles = require("../../Arrays/birthday-cake-candles"); | ||
const { describe, it } = require("mocha"); | ||
const { expect } = require("chai"); | ||
|
||
describe("Birthday Cake Candles", () => { | ||
it("returns 0 for empty array", () => { | ||
expect(birthdayCakeCandles([])).to.equal(0); | ||
}); | ||
|
||
it("returns 1 if there is only one candle", () => { | ||
expect(birthdayCakeCandles([1])).to.equal(1); | ||
expect(birthdayCakeCandles([2])).to.equal(1); | ||
expect(birthdayCakeCandles([3])).to.equal(1); | ||
}); | ||
|
||
it("returns 2 if there are two candles with the same height", () => { | ||
expect(birthdayCakeCandles([1, 1])).to.equal(2); | ||
expect(birthdayCakeCandles([2, 2])).to.equal(2); | ||
expect(birthdayCakeCandles([3, 3])).to.equal(2); | ||
}); | ||
|
||
it("returns correct amount for array with different sized candles", () => { | ||
expect(birthdayCakeCandles([3, 2, 1, 3])).to.equal(2); | ||
expect(birthdayCakeCandles([3, 2, 1, 3, 4, 5, 4])).to.equal(1); | ||
expect(birthdayCakeCandles([3, 2, 1, 1, 2, 2, 4, 4, 4])).to.equal(3); | ||
expect(birthdayCakeCandles([3, 2, 1])).to.equal(1); | ||
}); | ||
}); |