From 04830af2774dbbea1cc70d5bb0ac2658915326d4 Mon Sep 17 00:00:00 2001 From: Jack Greenlee Date: Fri, 16 Aug 2024 14:01:13 -0400 Subject: [PATCH] fix diaryHelper.test.ts modeColors is not in diaryHelper anymore; must be accessed from e-mission-common's `base_modes` --- www/__tests__/diaryHelper.test.ts | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/www/__tests__/diaryHelper.test.ts b/www/__tests__/diaryHelper.test.ts index c52e3f6dc..58cd20246 100644 --- a/www/__tests__/diaryHelper.test.ts +++ b/www/__tests__/diaryHelper.test.ts @@ -4,7 +4,6 @@ import { getFormattedDateAbbr, getFormattedTimeRange, getDetectedModes, - modeColors, } from '../js/diary/diaryHelper'; import { base_modes } from 'e-mission-common'; @@ -39,20 +38,17 @@ it('returns a human readable time range', () => { }); it('returns a Base Mode for a given key', () => { - expect(base_modes.get_base_mode_by_key('WALKING')).toEqual({ - name: 'WALKING', + expect(base_modes.get_base_mode_by_key('WALKING')).toMatchObject({ icon: 'walk', - color: modeColors.blue, + color: base_modes.mode_colors['blue'], }); - expect(base_modes.get_base_mode_by_key('MotionTypes.WALKING')).toEqual({ - name: 'WALKING', + expect(base_modes.get_base_mode_by_key('MotionTypes.WALKING')).toMatchObject({ icon: 'walk', - color: modeColors.blue, + color: base_modes.mode_colors['blue'], }); - expect(base_modes.get_base_mode_by_key('I made this type up')).toEqual({ - name: 'UNKNOWN', + expect(base_modes.get_base_mode_by_key('I made this type up')).toMatchObject({ icon: 'help', - color: modeColors.grey, + color: base_modes.mode_colors['grey'], }); }); @@ -88,11 +84,13 @@ let myFakeTrip2 = { }; let myFakeDetectedModes = [ - { mode: 'BICYCLING', icon: 'bike', color: modeColors.green, pct: 89 }, - { mode: 'WALKING', icon: 'walk', color: modeColors.blue, pct: 11 }, + { mode: 'BICYCLING', icon: 'bike', color: base_modes.mode_colors['green'], pct: 89 }, + { mode: 'WALKING', icon: 'walk', color: base_modes.mode_colors['blue'], pct: 11 }, ]; -let myFakeDetectedModes2 = [{ mode: 'BICYCLING', icon: 'bike', color: modeColors.green, pct: 100 }]; +let myFakeDetectedModes2 = [ + { mode: 'BICYCLING', icon: 'bike', color: base_modes.mode_colors['green'], pct: 100 }, +]; it('returns the detected modes, with percentages, for a trip', () => { expect(getDetectedModes(myFakeTrip)).toEqual(myFakeDetectedModes);