Client - display converted speed/elevation in workout chart
This commit is contained in:
@ -13,6 +13,7 @@ describe('getDatasets', () => {
|
||||
inputParams: {
|
||||
charData: [],
|
||||
locale: 'fr',
|
||||
useImperialUnits: false,
|
||||
},
|
||||
expected: {
|
||||
distance_labels: [],
|
||||
@ -72,6 +73,7 @@ describe('getDatasets', () => {
|
||||
},
|
||||
],
|
||||
locale: 'en',
|
||||
useImperialUnits: false,
|
||||
},
|
||||
expected: {
|
||||
distance_labels: [0, 0, 0.01],
|
||||
@ -102,12 +104,80 @@ describe('getDatasets', () => {
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
description: 'returns datasets w/ units conversion',
|
||||
inputParams: {
|
||||
charData: [
|
||||
{
|
||||
distance: 0,
|
||||
duration: 0,
|
||||
elevation: 83.6,
|
||||
latitude: 48.845574,
|
||||
longitude: 2.373723,
|
||||
speed: 2.89,
|
||||
time: 'Sun, 12 Sep 2021 13:29:24 GMT',
|
||||
},
|
||||
{
|
||||
distance: 0,
|
||||
duration: 1,
|
||||
elevation: 83.7,
|
||||
latitude: 48.845578,
|
||||
longitude: 2.373732,
|
||||
speed: 1.56,
|
||||
time: 'Sun, 12 Sep 2021 13:29:25 GMT',
|
||||
},
|
||||
{
|
||||
distance: 0.01,
|
||||
duration: 96,
|
||||
elevation: 84.3,
|
||||
latitude: 48.845591,
|
||||
longitude: 2.373811,
|
||||
speed: 14.73,
|
||||
time: 'Sun, 12 Sep 2021 13:31:00 GMT',
|
||||
},
|
||||
],
|
||||
locale: 'en',
|
||||
useImperialUnits: true,
|
||||
},
|
||||
expected: {
|
||||
distance_labels: [0, 0, 0.01],
|
||||
duration_labels: [0, 1, 96],
|
||||
datasets: {
|
||||
speed: {
|
||||
label: 'speed',
|
||||
backgroundColor: ['#FFFFFF'],
|
||||
borderColor: ['#8884d8'],
|
||||
borderWidth: 2,
|
||||
data: [1.8, 0.97, 9.15],
|
||||
yAxisID: 'ySpeed',
|
||||
},
|
||||
elevation: {
|
||||
label: 'elevation',
|
||||
backgroundColor: ['#e5e5e5'],
|
||||
borderColor: ['#cccccc'],
|
||||
borderWidth: 1,
|
||||
fill: true,
|
||||
data: [274.28, 274.61, 276.57],
|
||||
yAxisID: 'yElevation',
|
||||
},
|
||||
},
|
||||
coordinates: [
|
||||
{ latitude: 48.845574, longitude: 2.373723 },
|
||||
{ latitude: 48.845578, longitude: 2.373732 },
|
||||
{ latitude: 48.845591, longitude: 2.373811 },
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
testparams.map((testParams) => {
|
||||
it(testParams.description, () => {
|
||||
locale.value = testParams.inputParams.locale
|
||||
assert.deepEqual(
|
||||
getDatasets(testParams.inputParams.charData, t),
|
||||
getDatasets(
|
||||
testParams.inputParams.charData,
|
||||
t,
|
||||
testParams.inputParams.useImperialUnits
|
||||
),
|
||||
testParams.expected
|
||||
)
|
||||
})
|
||||
|
Reference in New Issue
Block a user