Skip to content

Commit 4d26f76

Browse files
authored
Update workoutSegment.test.js
1 parent ff5043e commit 4d26f76

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

app/engine/utils/workoutSegment.test.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,42 @@ import * as assert from 'uvu/assert'
1010
import { createWorkoutSegment } from './utils/workoutSegment.js'
1111

1212
test('Test workoutSegment initialisation behaviour without setting an interval', () => {
13-
let startingPoint = {
13+
const startingPoint = {
1414
totalMovingTime: 0,
15-
totalMovingTime: 0
15+
totalLinearDistance: 0
1616
}
1717

18-
let endPoint = {
18+
const endPoint = {
1919
totalMovingTime: 490,
20-
totalMovingTime: 2050
20+
totalLinearDistance: 2050
2121
}
2222

2323
const testSegment = createWorkoutSegment()
24-
testSegment.testDistanceFromStart(startingPoint, NaN)
25-
testSegment.testTimeSinceStart(startingPoint, NaN)
26-
testSegment.testdistanceToEnd(startingPoint, NaN)
27-
testSegment.testTimeToEnd(startingPoint, NaN)
28-
testSegment.testIsEndReached(endPoint, false)
24+
testDistanceFromStart(testSegment, startingPoint, NaN)
25+
testTimeSinceStart(testSegment, startingPoint, NaN)
26+
testdistanceToEnd(testSegment, startingPoint, NaN)
27+
testTimeToEnd(testSegment, startingPoint, NaN)
28+
testIsEndReached(testSegment, endPoint, false)
2929
})
3030

31-
function testDistanceFromStart (testedSegment, expectedValue) {
32-
assert.ok(testedSegment.distanceFromStart() === expectedValue, `Expected distance from the start should be ${expectedValue}, encountered ${testedSegment.distanceFromStart()}`)
31+
function testDistanceFromStart (testedSegment, testedDatapoint, expectedValue) {
32+
assert.ok(testedSegment.distanceFromStart(testedDatapoint) === expectedValue, `Expected distance from the start should be ${expectedValue}, encountered ${testedSegment.distanceFromStart(testedDatapoint)}`)
3333
}
3434

35-
function testTimeSinceStart (testedSegment, expectedValue) {
36-
assert.ok(testedSegment.timeSinceStart() === expectedValue, `Expected time since start should be ${expectedValue}, encountered ${testedSegment.timeSinceStart()}`)
35+
function testTimeSinceStart (testedSegment, testedDatapoint, expectedValue) {
36+
assert.ok(testedSegment.timeSinceStart(testedDatapoint) === expectedValue, `Expected time since start should be ${expectedValue}, encountered ${testedSegment.timeSinceStart(testedDatapoint)}`)
3737
}
3838

39-
function testdistanceToEnd (testedSegment, expectedValue) {
40-
assert.ok(testedSegment.distanceToEnd() === expectedValue, `Expected distance from the end to be ${expectedValue}, encountered ${testedSegment.distanceToEnd()}`)
39+
function testdistanceToEnd (testedSegment, testedDatapoint, expectedValue) {
40+
assert.ok(testedSegment.distanceToEnd(testedDatapoint) === expectedValue, `Expected distance from the end to be ${expectedValue}, encountered ${testedSegment.distanceToEnd(testedDatapoint)}`)
4141
}
4242

43-
function testTimeToEnd (testedSegment, expectedValue) {
44-
assert.ok(testedSegment.timeToEnd() === expectedValue, `Expected time to end to be ${expectedValue}, encountered ${testedSegment.timeToEnd()}`)
43+
function testTimeToEnd (testedSegment, testedDatapoint, expectedValue) {
44+
assert.ok(testedSegment.timeToEnd(testedDatapoint) === expectedValue, `Expected time to end to be ${expectedValue}, encountered ${testedSegment.timeToEnd(testedDatapoint)}`)
4545
}
4646

47-
function testIsEndReached (testedSegment, expectedValue) {
48-
assert.ok(testedSegment.isEndReached() === expectedValue, `Expected time to end to be ${expectedValue}, encountered ${testedSegment.isEndReached()}`)
47+
function testIsEndReached (testedSegment, testedDatapoint, expectedValue) {
48+
assert.ok(testedSegment.isEndReached(testedDatapoint) === expectedValue, `Expected time to end to be ${expectedValue}, encountered ${testedSegment.isEndReached(testedDatapoint)}`)
4949
}
5050

5151
test.run()

0 commit comments

Comments
 (0)