Skip to content

Commit 0ba6b71

Browse files
test: stub out test criteria for 2021-01 part 1
1 parent cc8239e commit 0ba6b71

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

2021/day-01/sonarSweep.test.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/* eslint-env mocha */
2+
const { expect } = require('chai')
3+
const { countIncreasingDepth } = require('./sonarSweep')
4+
5+
const pings = [
6+
199,
7+
200,
8+
208,
9+
210,
10+
200,
11+
207,
12+
240,
13+
269,
14+
260,
15+
263
16+
]
17+
18+
const singlePing = [
19+
199
20+
]
21+
22+
describe('--- Day 1: Sonar Sweep ---', () => {
23+
describe('Part 1', () => {
24+
describe('countIncreasingDepth()', () => {
25+
it('counts how many times the depth increases between two sequential measurements in an array', () => {
26+
expect(countIncreasingDepth(pings)).to.equal(7)
27+
})
28+
29+
it('skips the first measurement since there are no previous', () => {
30+
expect(countIncreasingDepth(singlePing)).to.equal(0)
31+
})
32+
})
33+
})
34+
})

0 commit comments

Comments
 (0)