Skip to content

Commit badf348

Browse files
chore(21018):setup TDD for day 1 part 1
1 parent 14fea23 commit badf348

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "standard"
3+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const chronalCalibrator = (input) => {
2+
let frequency = 0
3+
return frequency
4+
}
5+
6+
module.exports = chronalCalibrator

2018/day-01/part-1/test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* eslint-env mocha */
2+
const expect = require('chai').expect
3+
const chronalCalibrator = require('./chronalCalibrator')
4+
5+
describe('--- Day 1: Chronal Calibration ---', () => {
6+
it('should add a list frequency values', () => {
7+
const sequence = '+1, +1, +1'
8+
const expected = 3
9+
let actual = chronalCalibrator(sequence)
10+
expect(actual).to.equal(expected)
11+
})
12+
13+
it('should add a list frequency values', () => {
14+
const sequence = '-1, -2, -3'
15+
const expected = -6
16+
let actual = chronalCalibrator(sequence)
17+
expect(actual).to.equal(expected)
18+
})
19+
20+
it('should add a add and subtract a mixed list of frequency values', () => {
21+
const sequence = '+1, +1, -2'
22+
const expected = 0
23+
let actual = chronalCalibrator(sequence)
24+
expect(actual).to.equal(expected)
25+
})
26+
})

0 commit comments

Comments
 (0)