-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✅ #99 add unit test for gear telemetry
Signed-off-by: JAGFx <[email protected]>
- Loading branch information
Showing
4 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { $gearInfo } from '@/utils/telemetry/_grear.utils'; | ||
|
||
describe('Telemetry gear utils', () => { | ||
const generateTransmissionData = (gear) => { | ||
return { gear: { displayed: gear } }; | ||
}; | ||
|
||
describe('$gearInfo', () => { | ||
test.each(['Toto', 'Mercedes'])( | ||
'The crawling gear should not exist for unsupported brand truck', | ||
(brandName) => { | ||
const gearDisplayed = 5; | ||
const transmission = generateTransmissionData(gearDisplayed); | ||
const result = $gearInfo(transmission, { name: brandName }); | ||
|
||
expect(result).toEqual({ | ||
gear: gearDisplayed, | ||
crawlingGear: 0 | ||
}); | ||
} | ||
); | ||
|
||
test.each(['Volvo', 'Scania', 'Kenworth'])('tes', (brandName) => { | ||
const gearDisplayed = 5; | ||
const transmission = generateTransmissionData(gearDisplayed); | ||
const result = $gearInfo(transmission, { name: brandName }); | ||
|
||
expect(result).toEqual({ | ||
gear: gearDisplayed, | ||
crawlingGear: 2 | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters