We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc8239e commit 0ba6b71Copy full SHA for 0ba6b71
2021/day-01/sonarSweep.test.js
@@ -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
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