API & Client - add wind direction to workout detail - fix #134

This commit is contained in:
Sam
2022-01-15 21:54:37 +01:00
parent 7e2d123cdc
commit 5725a574bd
21 changed files with 165 additions and 30 deletions

View File

@ -0,0 +1,23 @@
import { assert } from 'chai'
import { convertDegreeToDirection } from '@/utils/weather'
describe('convertDegreeToDirection', () => {
const testsParams: [number, string][] = [
[0, 'N'],
[45, 'NE'],
[90, 'E'],
[135, 'SE'],
[180, 'S'],
[225, 'SW'],
[270, 'W'],
[315, 'NW'],
[22, 'NNE'],
[359, 'N'],
]
testsParams.map((testParams) => {
it(`convert ${testParams[0]}° to ${testParams[1]}`, () => {
assert.equal(convertDegreeToDirection(testParams[0]), testParams[1])
})
})
})