Skip to content

Commit

Permalink
chore: add test for eta calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
tkurki committed Jul 12, 2024
1 parent f49d09f commit 01317ae
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions calcs/eta.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ module.exports = function (app) {
}

var datems = date.getTime()
var timetopoint = Math.floor(
distance / velocityMadeGood * 1000
)
var timetopoint = Math.floor(distance / velocityMadeGood * 1000)

// app.debug(`Using datetime: ${date} ms to point : ${timetopoint} currentms: ${datems}`)
var etams = datems + timetopoint
Expand Down Expand Up @@ -50,6 +48,26 @@ module.exports = function (app) {
value: eta
}
]
}
},
tests: [
{
input: ['2024-07-12T18:00:00Z', 1000, 2],
expected: [
{
path:
'navigation.courseGreatCircle.nextPoint.estimatedTimeOfArrival',
value: '2024-07-12T18:08:20.000Z'
},
{
path: 'navigation.courseGreatCircle.nextPoint.timeToGo',
value: 500
},
{
path: 'navigation.courseGreatCircle.nextPoint.eta',
value: '2024-07-12T18:08:20.000Z'
}
]
}
]
}
}

0 comments on commit 01317ae

Please sign in to comment.