@hedia/recommendation-screen 1.8.2 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +0 -0
- package/.github/workflows/publish.yml +48 -0
- package/.github/workflows/version-check.yml +45 -0
- package/.linguirc +0 -0
- package/.npmpackagejsonlintrc.json +0 -0
- package/.prettierignore +0 -0
- package/.prettierrc +0 -0
- package/App.d.ts +4 -5
- package/App.jsx +23 -34
- package/App.tsx +36 -41
- package/Changelog.md +0 -0
- package/README.md +0 -0
- package/android/app/BUCK +0 -0
- package/android/app/build.gradle +0 -0
- package/android/app/build_defs.bzl +0 -0
- package/android/app/debug.keystore +0 -0
- package/android/app/proguard-rules.pro +0 -0
- package/android/app/src/debug/AndroidManifest.xml +0 -0
- package/android/app/src/debug/java/com/hediarecommendationscreen/ReactNativeFlipper.java +0 -0
- package/android/app/src/main/AndroidManifest.xml +0 -0
- package/android/app/src/main/assets/fonts/AntDesign.ttf +0 -0
- package/android/app/src/main/assets/fonts/Entypo.ttf +0 -0
- package/android/app/src/main/assets/fonts/EvilIcons.ttf +0 -0
- package/android/app/src/main/assets/fonts/Feather.ttf +0 -0
- package/android/app/src/main/assets/fonts/FontAwesome.ttf +0 -0
- package/android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf +0 -0
- package/android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf +0 -0
- package/android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf +0 -0
- package/android/app/src/main/assets/fonts/Foundation.ttf +0 -0
- package/android/app/src/main/assets/fonts/Ionicons.ttf +0 -0
- package/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf +0 -0
- package/android/app/src/main/assets/fonts/MaterialIcons.ttf +0 -0
- package/android/app/src/main/assets/fonts/Octicons.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Black.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-BlackItalic.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Bold.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-BoldItalic.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Italic.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Light.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-LightItalic.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Medium.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-MediumItalic.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Regular.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Thin.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-ThinItalic.ttf +0 -0
- package/android/app/src/main/assets/fonts/SimpleLineIcons.ttf +0 -0
- package/android/app/src/main/assets/fonts/Zocial.ttf +0 -0
- package/android/app/src/main/java/com/hediarecommendationscreen/MainActivity.java +0 -0
- package/android/app/src/main/java/com/hediarecommendationscreen/MainApplication.java +0 -0
- package/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/values/color.xml +0 -0
- package/android/app/src/main/res/values/strings.xml +0 -0
- package/android/app/src/main/res/values/styles.xml +0 -0
- package/android/build.gradle +0 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -0
- package/android/gradle.properties +0 -0
- package/android/gradlew.bat +0 -0
- package/android/settings.gradle +0 -0
- package/app.json +0 -0
- package/assets/fonts/Roboto/LICENSE.txt +0 -0
- package/assets/fonts/Roboto/Roboto-Black.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-BlackItalic.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Bold.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-BoldItalic.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Italic.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Light.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-LightItalic.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Medium.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Regular.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Thin.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-ThinItalic.ttf +0 -0
- package/babel.config.js +0 -0
- package/ignore-git.sh +1 -1
- package/ignore-publish.sh +2 -1
- package/index.d.ts +2 -2
- package/index.js +2 -3
- package/index.ts +2 -2
- package/ios/HediaRecommendationScreen/AppDelegate.h +0 -0
- package/ios/HediaRecommendationScreen/AppDelegate.m +0 -0
- package/ios/HediaRecommendationScreen/Base.lproj/LaunchScreen.xib +0 -0
- package/ios/HediaRecommendationScreen/Images.xcassets/AppIcon.appiconset/Contents.json +0 -0
- package/ios/HediaRecommendationScreen/Images.xcassets/Contents.json +0 -0
- package/ios/HediaRecommendationScreen/Info.plist +0 -0
- package/ios/HediaRecommendationScreen/main.m +0 -0
- package/ios/HediaRecommendationScreen-tvOS/Info.plist +0 -0
- package/ios/HediaRecommendationScreen-tvOSTests/Info.plist +0 -0
- package/ios/HediaRecommendationScreen.xcodeproj/project.pbxproj +0 -0
- package/ios/HediaRecommendationScreen.xcodeproj/xcshareddata/xcschemes/HediaRecommendationScreen-tvOS.xcscheme +0 -0
- package/ios/HediaRecommendationScreen.xcodeproj/xcshareddata/xcschemes/HediaRecommendationScreen.xcscheme +0 -0
- package/ios/HediaRecommendationScreen.xcworkspace/contents.xcworkspacedata +0 -0
- package/ios/HediaRecommendationScreen.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
- package/ios/HediaRecommendationScreenTests/HediaRecommendationScreenTests.m +0 -0
- package/ios/HediaRecommendationScreenTests/Info.plist +0 -0
- package/ios/Podfile +0 -0
- package/ios/Podfile.lock +0 -0
- package/jest.config.js +0 -0
- package/jest.mock.js +0 -0
- package/metro.config.js +0 -0
- package/package.json +8 -10
- package/react-native.config.js +0 -0
- package/src/RecommendationScreen.d.ts +18 -20
- package/src/RecommendationScreen.jsx +26 -15
- package/src/RecommendationScreen.tsx +60 -37
- package/src/__tests__/RecommendationScreen.test.d.ts +0 -0
- package/src/__tests__/RecommendationScreen.test.jsx +163 -138
- package/src/__tests__/RecommendationScreen.test.tsx +256 -159
- package/src/__tests__/RecommendationUtils.test.d.ts +0 -0
- package/src/__tests__/RecommendationUtils.test.js +30 -39
- package/src/__tests__/RecommendationUtils.test.ts +38 -43
- package/src/__tests__/Translate.test.d.ts +0 -0
- package/src/__tests__/Translate.test.jsx +13 -12
- package/src/__tests__/Translate.test.tsx +15 -14
- package/src/__tests__/Utils.test.d.ts +0 -0
- package/src/__tests__/Utils.test.js +22 -20
- package/src/__tests__/Utils.test.ts +32 -21
- package/src/__tests__/Validations.test.d.ts +0 -0
- package/src/__tests__/Validations.test.js +59 -33
- package/src/__tests__/Validations.test.ts +83 -41
- package/src/__tests__/components/Activity.test.d.ts +0 -0
- package/src/__tests__/components/Activity.test.jsx +39 -18
- package/src/__tests__/components/Activity.test.tsx +99 -45
- package/src/__tests__/components/Emotion.test.d.ts +0 -0
- package/src/__tests__/components/Emotion.test.jsx +34 -25
- package/src/__tests__/components/Emotion.test.tsx +41 -24
- package/src/__tests__/components/Header.test.d.ts +0 -0
- package/src/__tests__/components/Header.test.jsx +10 -9
- package/src/__tests__/components/Header.test.tsx +12 -11
- package/src/__tests__/components/InfoBars.test.d.ts +0 -0
- package/src/__tests__/components/InfoBars.test.jsx +1 -0
- package/src/__tests__/components/InfoBars.test.tsx +7 -6
- package/src/__tests__/components/InvisibleNumberInput.test.d.ts +0 -0
- package/src/__tests__/components/InvisibleNumberInput.test.jsx +40 -24
- package/src/__tests__/components/InvisibleNumberInput.test.tsx +41 -17
- package/src/__tests__/components/LimitationMessage.test.d.ts +0 -0
- package/src/__tests__/components/LimitationMessage.test.jsx +11 -30
- package/src/__tests__/components/LimitationMessage.test.tsx +15 -13
- package/src/__tests__/components/MoodIcon.test.d.ts +0 -0
- package/src/__tests__/components/MoodIcon.test.jsx +12 -8
- package/src/__tests__/components/MoodIcon.test.tsx +13 -5
- package/src/__tests__/components/RecommendationModal.test.d.ts +0 -0
- package/src/__tests__/components/RecommendationModal.test.jsx +22 -21
- package/src/__tests__/components/RecommendationModal.test.tsx +29 -27
- package/src/__tests__/components/RecommendedCarbs.test.d.ts +0 -0
- package/src/__tests__/components/RecommendedCarbs.test.jsx +7 -10
- package/src/__tests__/components/RecommendedCarbs.test.tsx +9 -10
- package/src/__tests__/components/RecommendedInsulin.test.d.ts +0 -0
- package/src/__tests__/components/RecommendedInsulin.test.jsx +57 -41
- package/src/__tests__/components/RecommendedInsulin.test.tsx +57 -31
- package/src/__tests__/components/Remeasure.test.d.ts +0 -0
- package/src/__tests__/components/Remeasure.test.jsx +7 -3
- package/src/__tests__/components/Remeasure.test.tsx +11 -3
- package/src/__tests__/components/TransferToLogbook.test.d.ts +0 -0
- package/src/__tests__/components/TransferToLogbook.test.jsx +2 -2
- package/src/__tests__/components/TransferToLogbook.test.tsx +2 -2
- package/src/__tests__/components/TwoOptionModal.test.d.ts +0 -0
- package/src/__tests__/components/TwoOptionModal.test.jsx +5 -4
- package/src/__tests__/components/TwoOptionModal.test.tsx +6 -4
- package/src/__tests__/utils.d.ts +7 -2
- package/src/__tests__/utils.jsx +59 -15
- package/src/__tests__/utils.tsx +63 -16
- package/src/assets/activity/Cyclist.png +0 -0
- package/src/assets/activity/Other.png +0 -0
- package/src/assets/activity/Runner.png +0 -0
- package/src/assets/activity/Swimmer.png +0 -0
- package/src/assets/activity/Walk.png +0 -0
- package/src/assets/mood/happy.png +0 -0
- package/src/assets/mood/happy_active.png +0 -0
- package/src/assets/mood/neutral.png +0 -0
- package/src/assets/mood/neutral_active.png +0 -0
- package/src/assets/mood/sad.png +0 -0
- package/src/assets/mood/sad_active.png +0 -0
- package/src/assets/mood/semi_happy.png +0 -0
- package/src/assets/mood/semi_happy_active.png +0 -0
- package/src/assets/mood/semi_sad.png +0 -0
- package/src/assets/mood/semi_sad_active.png +0 -0
- package/src/components/Header.d.ts +0 -0
- package/src/components/Header.jsx +2 -1
- package/src/components/Header.tsx +2 -1
- package/src/components/Icon.js +0 -0
- package/src/components/InfoBars.d.ts +1 -1
- package/src/components/InfoBars.jsx +0 -0
- package/src/components/InfoBars.tsx +1 -1
- package/src/components/InvisibleNumberInput.d.ts +2 -1
- package/src/components/InvisibleNumberInput.jsx +7 -2
- package/src/components/InvisibleNumberInput.tsx +10 -3
- package/src/components/LimitationMessage.d.ts +1 -1
- package/src/components/LimitationMessage.jsx +3 -2
- package/src/components/LimitationMessage.tsx +3 -1
- package/src/components/LineSeparator.d.ts +0 -0
- package/src/components/LineSeparator.jsx +0 -0
- package/src/components/LineSeparator.tsx +0 -0
- package/src/components/RecentInsulin.d.ts +0 -0
- package/src/components/RecentInsulin.jsx +3 -2
- package/src/components/RecentInsulin.tsx +3 -0
- package/src/components/RecommendationModal.d.ts +4 -4
- package/src/components/RecommendationModal.jsx +10 -9
- package/src/components/RecommendationModal.tsx +19 -8
- package/src/components/RecommendedCarbs.d.ts +4 -3
- package/src/components/RecommendedCarbs.jsx +12 -9
- package/src/components/RecommendedCarbs.tsx +31 -16
- package/src/components/RecommendedInsulin.d.ts +7 -7
- package/src/components/RecommendedInsulin.jsx +11 -7
- package/src/components/RecommendedInsulin.tsx +24 -12
- package/src/components/Remeasure.d.ts +2 -2
- package/src/components/Remeasure.jsx +7 -2
- package/src/components/Remeasure.tsx +10 -4
- package/src/components/TransferToLogbook.d.ts +0 -0
- package/src/components/TransferToLogbook.jsx +2 -1
- package/src/components/TransferToLogbook.tsx +2 -0
- package/src/components/TwoOptionModal.d.ts +5 -3
- package/src/components/TwoOptionModal.jsx +44 -13
- package/src/components/TwoOptionModal.tsx +50 -14
- package/src/components/activity/Activity.d.ts +2 -3
- package/src/components/activity/Activity.jsx +5 -2
- package/src/components/activity/Activity.tsx +7 -5
- package/src/components/activity/ActivityIcon.d.ts +1 -1
- package/src/components/activity/ActivityIcon.jsx +9 -8
- package/src/components/activity/ActivityIcon.tsx +12 -10
- package/src/components/activity/ActivityIntensity.d.ts +1 -1
- package/src/components/activity/ActivityIntensity.jsx +2 -8
- package/src/components/activity/ActivityIntensity.tsx +3 -12
- package/src/components/mood/Emotion.d.ts +5 -4
- package/src/components/mood/Emotion.jsx +4 -3
- package/src/components/mood/Emotion.tsx +9 -7
- package/src/components/mood/MoodIcon.d.ts +2 -2
- package/src/components/mood/MoodIcon.jsx +3 -2
- package/src/components/mood/MoodIcon.tsx +4 -2
- package/src/locale/CleanLanguage.ts +0 -0
- package/src/locale/da/messages.js +1 -1
- package/src/locale/da/messages.po +115 -107
- package/src/locale/de/messages.js +1 -1
- package/src/locale/de/messages.po +115 -107
- package/src/locale/en/messages.js +1 -1
- package/src/locale/en/messages.po +118 -110
- package/src/locale/es/messages.js +1 -1
- package/src/locale/es/messages.po +112 -104
- package/src/locale/fr/messages.js +1 -1
- package/src/locale/fr/messages.po +111 -103
- package/src/locale/i18nUtils.d.ts +3 -4
- package/src/locale/i18nUtils.js +13 -12
- package/src/locale/i18nUtils.ts +14 -14
- package/src/locale/it/messages.js +1 -1
- package/src/locale/it/messages.po +113 -105
- package/src/types/enum.d.ts +52 -44
- package/src/types/enum.js +67 -56
- package/src/types/enum.ts +58 -34
- package/src/types/types.d.ts +9 -23
- package/src/types/types.js +0 -0
- package/src/types/types.ts +9 -25
- package/src/utils/AttentionMessages.d.ts +1 -4
- package/src/utils/AttentionMessages.jsx +8 -30
- package/src/utils/AttentionMessages.tsx +11 -16
- package/src/utils/Constants.d.ts +0 -0
- package/src/utils/Constants.js +0 -0
- package/src/utils/Constants.ts +0 -0
- package/src/utils/RecommendationError.d.ts +2 -0
- package/src/utils/RecommendationError.jsx +45 -40
- package/src/utils/RecommendationError.tsx +17 -4
- package/src/utils/RecommendationUtils.d.ts +7 -8
- package/src/utils/RecommendationUtils.js +15 -7
- package/src/utils/RecommendationUtils.ts +24 -14
- package/src/utils/Translations.d.ts +2 -0
- package/src/utils/Translations.js +10 -0
- package/src/utils/Translations.ts +9 -0
- package/src/utils/Utils.d.ts +4 -5
- package/src/utils/Utils.js +6 -5
- package/src/utils/Utils.ts +10 -8
- package/src/utils/Validations.d.ts +10 -9
- package/src/utils/Validations.js +61 -65
- package/src/utils/Validations.ts +76 -81
- package/tsconfig.json +2 -2
- package/tslint.json +0 -0
|
@@ -1,43 +1,57 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Activity, Languages } from "@hedia/types";
|
|
2
2
|
import { I18nProvider } from "@lingui/react";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { cleanup, render } from "react-native-testing-library";
|
|
5
|
-
import
|
|
5
|
+
import { default as ActivityComponent } from "../../components/activity/Activity";
|
|
6
6
|
import { i18n } from "../../locale/i18nUtils";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { ActivityTestIds } from "../../types/enum";
|
|
8
|
+
import { ActivityIntensityTranslations } from "../../utils/Translations";
|
|
9
|
+
import {
|
|
10
|
+
expectTextExists,
|
|
11
|
+
generateActivityProps,
|
|
12
|
+
getRecommendationProps,
|
|
13
|
+
i18nProvided,
|
|
14
|
+
queryTextFromComponent,
|
|
15
|
+
} from "../utils";
|
|
16
|
+
|
|
17
|
+
const ActivityIntensity = Activity.Enums.ActivityIntensity;
|
|
18
|
+
const { light, moderate, hard } = ActivityIntensity;
|
|
9
19
|
|
|
10
20
|
describe(`Activity - Component`, (): void => {
|
|
11
21
|
afterEach(cleanup);
|
|
22
|
+
|
|
12
23
|
beforeEach((): void => {
|
|
13
|
-
i18n.activate(
|
|
24
|
+
i18n.activate(Languages.en);
|
|
14
25
|
});
|
|
15
26
|
|
|
16
27
|
test.each`
|
|
17
28
|
activityIntensity
|
|
18
|
-
${
|
|
19
|
-
${
|
|
20
|
-
${
|
|
21
|
-
`(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
${light}
|
|
30
|
+
${moderate}
|
|
31
|
+
${hard}
|
|
32
|
+
`(
|
|
33
|
+
`Renders $activityIntensity`,
|
|
34
|
+
({ activityIntensity }: { activityIntensity: Activity.Enums.ActivityIntensity }): void => {
|
|
35
|
+
const { activityDisplayProps } = getRecommendationProps();
|
|
36
|
+
const activity = generateActivityProps();
|
|
37
|
+
const wrapper = render(
|
|
38
|
+
i18nProvided(
|
|
39
|
+
<ActivityComponent
|
|
40
|
+
activity={{ ...activity, activityIntensity }}
|
|
41
|
+
activityType={activityDisplayProps?.activityType ?? null}
|
|
42
|
+
activityTitle={activityDisplayProps?.activityTitle ?? null}
|
|
43
|
+
activityReduction={0}
|
|
44
|
+
/>,
|
|
45
|
+
),
|
|
46
|
+
);
|
|
34
47
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
expectTextExists(wrapper, `Activity`);
|
|
49
|
+
expectTextExists(wrapper, `30`);
|
|
50
|
+
expectTextExists(wrapper, `min`);
|
|
51
|
+
expectTextExists(wrapper, `Based on the selected activity your insulin recommendation is reduced by:`);
|
|
52
|
+
expectTextExists(wrapper, ActivityIntensityTranslations[activityIntensity]());
|
|
53
|
+
},
|
|
54
|
+
);
|
|
41
55
|
|
|
42
56
|
test.each`
|
|
43
57
|
reduction
|
|
@@ -53,11 +67,11 @@ describe(`Activity - Component`, (): void => {
|
|
|
53
67
|
const activity = generateActivityProps();
|
|
54
68
|
const wrapper = render(
|
|
55
69
|
i18nProvided(
|
|
56
|
-
<
|
|
70
|
+
<ActivityComponent
|
|
57
71
|
activity={activity}
|
|
58
|
-
activityType={activityDisplayProps
|
|
72
|
+
activityType={activityDisplayProps?.activityType ?? null}
|
|
59
73
|
activityReduction={reduction}
|
|
60
|
-
activityTitle={activityDisplayProps
|
|
74
|
+
activityTitle={activityDisplayProps?.activityTitle ?? null}
|
|
61
75
|
/>,
|
|
62
76
|
),
|
|
63
77
|
);
|
|
@@ -66,44 +80,84 @@ describe(`Activity - Component`, (): void => {
|
|
|
66
80
|
},
|
|
67
81
|
);
|
|
68
82
|
|
|
83
|
+
test(`Renders activity reduction as 0 when null is passed`, (): void => {
|
|
84
|
+
const { activityDisplayProps } = getRecommendationProps();
|
|
85
|
+
const activity = generateActivityProps();
|
|
86
|
+
const reduction = null;
|
|
87
|
+
const wrapper = render(
|
|
88
|
+
i18nProvided(
|
|
89
|
+
<ActivityComponent
|
|
90
|
+
activity={activity}
|
|
91
|
+
activityType={activityDisplayProps?.activityType ?? null}
|
|
92
|
+
activityReduction={reduction}
|
|
93
|
+
activityTitle={activityDisplayProps?.activityTitle ?? null}
|
|
94
|
+
/>,
|
|
95
|
+
),
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const text = queryTextFromComponent(wrapper, ActivityTestIds.ActivityReduction);
|
|
99
|
+
expect(text).toBe(`0%`);
|
|
100
|
+
});
|
|
101
|
+
|
|
69
102
|
test(`Can render activity title`, (): void => {
|
|
70
103
|
const { activityDisplayProps } = getRecommendationProps();
|
|
71
104
|
const activity = generateActivityProps();
|
|
72
105
|
const wrapper = render(
|
|
73
106
|
i18nProvided(
|
|
74
|
-
<
|
|
107
|
+
<ActivityComponent
|
|
75
108
|
activity={{ ...activity }}
|
|
76
|
-
activityType={activityDisplayProps
|
|
77
|
-
activityTitle={activityDisplayProps
|
|
109
|
+
activityType={activityDisplayProps?.activityType ?? null}
|
|
110
|
+
activityTitle={activityDisplayProps?.activityTitle ?? null}
|
|
78
111
|
activityReduction={0}
|
|
79
112
|
/>,
|
|
80
113
|
),
|
|
81
114
|
);
|
|
82
|
-
expectTextExists(wrapper, activityDisplayProps
|
|
115
|
+
expectTextExists(wrapper, activityDisplayProps?.activityTitle!);
|
|
83
116
|
});
|
|
84
117
|
|
|
85
118
|
test.each`
|
|
86
|
-
language | locale
|
|
87
|
-
${`English`} | ${
|
|
88
|
-
${`Danish`} | ${
|
|
89
|
-
${`German`} | ${
|
|
90
|
-
${`Spanish`} | ${
|
|
91
|
-
${`Italian`} | ${
|
|
92
|
-
${`French`} | ${
|
|
93
|
-
`(`Can render in $language`, ({ message, locale }: { locale:
|
|
119
|
+
language | locale | message
|
|
120
|
+
${`English`} | ${Languages.en} | ${`Activity`}
|
|
121
|
+
${`Danish`} | ${Languages.da} | ${`Aktivitet`}
|
|
122
|
+
${`German`} | ${Languages.de} | ${`Aktivität`}
|
|
123
|
+
${`Spanish`} | ${Languages.es} | ${`Actividad`}
|
|
124
|
+
${`Italian`} | ${Languages.it} | ${`Attività fisica`}
|
|
125
|
+
${`French`} | ${Languages.fr} | ${`Activité`}
|
|
126
|
+
`(`Can render in $language`, ({ message, locale }: { locale: Languages; message: string }): void => {
|
|
94
127
|
const { activityDisplayProps } = getRecommendationProps();
|
|
95
128
|
const activity = generateActivityProps();
|
|
96
129
|
i18n.activate(locale);
|
|
97
130
|
const wrapper = render(
|
|
98
131
|
<I18nProvider language={locale} i18n={i18n}>
|
|
99
|
-
<
|
|
132
|
+
<ActivityComponent
|
|
100
133
|
activity={activity}
|
|
101
|
-
activityType={activityDisplayProps
|
|
102
|
-
activityTitle={activityDisplayProps
|
|
134
|
+
activityType={activityDisplayProps?.activityType ?? null}
|
|
135
|
+
activityTitle={activityDisplayProps?.activityTitle ?? null}
|
|
103
136
|
activityReduction={0}
|
|
104
137
|
/>
|
|
105
138
|
</I18nProvider>,
|
|
106
139
|
);
|
|
107
140
|
expectTextExists(wrapper, message);
|
|
108
141
|
});
|
|
142
|
+
|
|
143
|
+
test(`ActivityIcon defaults to other if activityType is null`, (): void => {
|
|
144
|
+
const { activityDisplayProps } = getRecommendationProps();
|
|
145
|
+
const activity = generateActivityProps();
|
|
146
|
+
const wrapper = render(
|
|
147
|
+
i18nProvided(
|
|
148
|
+
<ActivityComponent
|
|
149
|
+
activity={{ ...activity }}
|
|
150
|
+
activityType={null}
|
|
151
|
+
activityTitle={activityDisplayProps?.activityTitle ?? null}
|
|
152
|
+
activityReduction={0}
|
|
153
|
+
/>,
|
|
154
|
+
),
|
|
155
|
+
);
|
|
156
|
+
expectTextExists(wrapper, activityDisplayProps?.activityTitle!);
|
|
157
|
+
const existingLabel = `${Activity.Enums.ActivityEnum[Activity.Enums.ActivityEnum.Other]}_activity`;
|
|
158
|
+
const nonExistingLabel = `${Activity.Enums.ActivityEnum[Activity.Enums.ActivityEnum.Run]}_activity`;
|
|
159
|
+
|
|
160
|
+
expect(wrapper.queryByA11yLabel(existingLabel)).not.toBeNull();
|
|
161
|
+
expect(wrapper.queryByA11yLabel(nonExistingLabel)).toBeNull();
|
|
162
|
+
});
|
|
109
163
|
});
|
|
File without changes
|
|
@@ -3,16 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const types_1 = require("@hedia/types");
|
|
6
7
|
const react_1 = __importDefault(require("react"));
|
|
7
8
|
const react_native_testing_library_1 = require("react-native-testing-library");
|
|
8
9
|
const Emotion_1 = __importDefault(require("../../components/mood/Emotion"));
|
|
9
10
|
const i18nUtils_1 = require("../../locale/i18nUtils");
|
|
10
|
-
const enum_1 = require("../../types/enum");
|
|
11
11
|
const utils_1 = require("../utils");
|
|
12
|
+
const MoodEnum = types_1.Logbook.Enums.MoodEnum;
|
|
12
13
|
describe(`Emotion - Component`, () => {
|
|
13
14
|
afterEach(react_native_testing_library_1.cleanup);
|
|
14
15
|
beforeEach(() => {
|
|
15
|
-
i18nUtils_1.i18n.activate(
|
|
16
|
+
i18nUtils_1.i18n.activate(types_1.Languages.en);
|
|
16
17
|
});
|
|
17
18
|
test(`Can mount component in `, () => {
|
|
18
19
|
const mockSelected = jest.fn();
|
|
@@ -21,47 +22,55 @@ describe(`Emotion - Component`, () => {
|
|
|
21
22
|
});
|
|
22
23
|
test.each `
|
|
23
24
|
mood | moodName | preselected | preselectedName
|
|
24
|
-
${
|
|
25
|
-
${
|
|
26
|
-
${
|
|
27
|
-
${
|
|
28
|
-
${
|
|
25
|
+
${MoodEnum.Happy} | ${MoodEnum[MoodEnum.Happy]} | ${MoodEnum.Sad} | ${MoodEnum[MoodEnum.Sad]}
|
|
26
|
+
${MoodEnum.SemiHappy} | ${MoodEnum[MoodEnum.SemiHappy]} | ${MoodEnum.Happy} | ${MoodEnum[MoodEnum.Happy]}
|
|
27
|
+
${MoodEnum.Neutral} | ${MoodEnum[MoodEnum.Neutral]} | ${MoodEnum.SemiHappy} | ${MoodEnum[MoodEnum.SemiHappy]}
|
|
28
|
+
${MoodEnum.SemiSad} | ${MoodEnum[MoodEnum.SemiSad]} | ${MoodEnum.Neutral} | ${MoodEnum[MoodEnum.Neutral]}
|
|
29
|
+
${MoodEnum.Sad} | ${MoodEnum[MoodEnum.Sad]} | ${MoodEnum.SemiSad} | ${MoodEnum[MoodEnum.SemiSad]}
|
|
29
30
|
`(`Pressing on $moodName icon deselects others`, ({ mood, moodName, preselected, preselectedName, }) => {
|
|
30
31
|
let mockedStateMood = preselected;
|
|
31
32
|
const mockSelected = jest.fn((selectedMood) => (mockedStateMood = selectedMood));
|
|
32
33
|
const wrapper = react_native_testing_library_1.render(<Emotion_1.default moodSelected={mockSelected} currentMood={mockedStateMood}/>);
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const preIcon = utils_1.getIcon(wrapper, preselectedName, true);
|
|
35
|
+
if (preIcon === null) {
|
|
36
|
+
return fail(`No icon found for queryByA11yLabel: ${preselectedName}_${true}`);
|
|
37
|
+
}
|
|
38
|
+
const newIcon = utils_1.getIcon(wrapper, moodName, false);
|
|
39
|
+
if (newIcon === null) {
|
|
40
|
+
return fail(`No icon found for queryByA11yLabel: ${moodName}_${false}`);
|
|
41
|
+
}
|
|
36
42
|
// Select a different mood
|
|
37
|
-
react_native_testing_library_1.fireEvent(
|
|
43
|
+
react_native_testing_library_1.fireEvent(newIcon, `onPress`);
|
|
38
44
|
expect(mockedStateMood).toBe(mood);
|
|
39
45
|
wrapper.update(<Emotion_1.default moodSelected={mockSelected} currentMood={mockedStateMood}/>);
|
|
40
|
-
Object.keys(
|
|
46
|
+
Object.keys(MoodEnum)
|
|
41
47
|
.filter((key) => /[0-9]/.test(key))
|
|
42
48
|
.forEach((key) => {
|
|
43
|
-
if (moodName ===
|
|
44
|
-
expect(getIcon(
|
|
45
|
-
expect(getIcon(
|
|
49
|
+
if (moodName === MoodEnum[key]) {
|
|
50
|
+
expect(utils_1.getIcon(wrapper, MoodEnum[key], true)).not.toBeNull();
|
|
51
|
+
expect(utils_1.getIcon(wrapper, MoodEnum[key], false)).toBeNull();
|
|
46
52
|
}
|
|
47
53
|
else {
|
|
48
|
-
expect(getIcon(
|
|
49
|
-
expect(getIcon(
|
|
54
|
+
expect(utils_1.getIcon(wrapper, MoodEnum[key], false)).not.toBeNull();
|
|
55
|
+
expect(utils_1.getIcon(wrapper, MoodEnum[key], true)).toBeNull();
|
|
50
56
|
}
|
|
51
57
|
});
|
|
52
58
|
});
|
|
53
59
|
test(`Deselecting selected icon by pressing it again`, () => {
|
|
54
|
-
let mockedStateMood =
|
|
60
|
+
let mockedStateMood = MoodEnum.Happy;
|
|
55
61
|
const mockSelected = jest.fn((newMood) => (mockedStateMood = newMood));
|
|
56
|
-
const mood =
|
|
62
|
+
const mood = MoodEnum[mockedStateMood];
|
|
57
63
|
const wrapper = react_native_testing_library_1.render(<Emotion_1.default moodSelected={mockSelected} currentMood={mockedStateMood}/>);
|
|
58
|
-
const getIcon = (name, active) => wrapper.queryByA11yLabel(`${name}_${active}`);
|
|
59
64
|
// current mood has already been selected: Happy
|
|
60
|
-
expect(getIcon(mood, true)).not.toBeNull();
|
|
61
|
-
expect(getIcon(mood, false)).toBeNull();
|
|
62
|
-
|
|
65
|
+
expect(utils_1.getIcon(wrapper, mood, true)).not.toBeNull();
|
|
66
|
+
expect(utils_1.getIcon(wrapper, mood, false)).toBeNull();
|
|
67
|
+
const icon = utils_1.getIcon(wrapper, mood, true);
|
|
68
|
+
if (icon === null) {
|
|
69
|
+
return fail(`No icon found for queryByA11yLabel: ${mood}_${true}`);
|
|
70
|
+
}
|
|
71
|
+
react_native_testing_library_1.fireEvent(icon, `onPress`);
|
|
63
72
|
wrapper.update(<Emotion_1.default moodSelected={mockSelected} currentMood={mockedStateMood}/>);
|
|
64
|
-
expect(getIcon(mood, true)).toBeNull();
|
|
65
|
-
expect(getIcon(mood, false)).not.toBeNull();
|
|
73
|
+
expect(utils_1.getIcon(wrapper, mood, true)).toBeNull();
|
|
74
|
+
expect(utils_1.getIcon(wrapper, mood, false)).not.toBeNull();
|
|
66
75
|
});
|
|
67
76
|
});
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import { Languages, Logbook } from "@hedia/types";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { cleanup, fireEvent, render } from "react-native-testing-library";
|
|
3
4
|
import Emotion from "../../components/mood/Emotion";
|
|
4
5
|
import { i18n } from "../../locale/i18nUtils";
|
|
5
|
-
import {
|
|
6
|
-
|
|
6
|
+
import { expectTextExists, getIcon, i18nProvided } from "../utils";
|
|
7
|
+
|
|
8
|
+
const MoodEnum = Logbook.Enums.MoodEnum;
|
|
7
9
|
|
|
8
10
|
describe(`Emotion - Component`, (): void => {
|
|
9
11
|
afterEach(cleanup);
|
|
10
12
|
beforeEach((): void => {
|
|
11
|
-
i18n.activate(
|
|
13
|
+
i18n.activate(Languages.en);
|
|
12
14
|
});
|
|
13
15
|
|
|
14
16
|
test(`Can mount component in `, (): void => {
|
|
@@ -33,23 +35,32 @@ describe(`Emotion - Component`, (): void => {
|
|
|
33
35
|
preselected,
|
|
34
36
|
preselectedName,
|
|
35
37
|
}: {
|
|
36
|
-
mood: MoodEnum;
|
|
38
|
+
mood: Logbook.Enums.MoodEnum;
|
|
37
39
|
moodName: string;
|
|
38
|
-
preselected: MoodEnum;
|
|
40
|
+
preselected: Logbook.Enums.MoodEnum;
|
|
39
41
|
preselectedName: string;
|
|
40
42
|
}): void => {
|
|
41
|
-
let mockedStateMood: MoodEnum = preselected;
|
|
42
|
-
const mockSelected = jest.fn(
|
|
43
|
+
let mockedStateMood: Logbook.Enums.MoodEnum = preselected;
|
|
44
|
+
const mockSelected = jest.fn(
|
|
45
|
+
(selectedMood: Logbook.Enums.MoodEnum): Logbook.Enums.MoodEnum => (mockedStateMood = selectedMood),
|
|
46
|
+
);
|
|
43
47
|
|
|
44
48
|
const wrapper = render(<Emotion moodSelected={mockSelected} currentMood={mockedStateMood} />);
|
|
45
49
|
|
|
46
|
-
const
|
|
50
|
+
const preIcon = getIcon(wrapper, preselectedName, true);
|
|
51
|
+
|
|
52
|
+
if (preIcon === null) {
|
|
53
|
+
return fail(`No icon found for queryByA11yLabel: ${preselectedName}_${true}`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const newIcon = getIcon(wrapper, moodName, false);
|
|
47
57
|
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
if (newIcon === null) {
|
|
59
|
+
return fail(`No icon found for queryByA11yLabel: ${moodName}_${false}`);
|
|
60
|
+
}
|
|
50
61
|
|
|
51
62
|
// Select a different mood
|
|
52
|
-
fireEvent(
|
|
63
|
+
fireEvent(newIcon, `onPress`);
|
|
53
64
|
|
|
54
65
|
expect(mockedStateMood).toBe(mood);
|
|
55
66
|
|
|
@@ -59,35 +70,41 @@ describe(`Emotion - Component`, (): void => {
|
|
|
59
70
|
.filter((key): boolean => /[0-9]/.test(key))
|
|
60
71
|
.forEach((key): void => {
|
|
61
72
|
if (moodName === MoodEnum[key]) {
|
|
62
|
-
expect(getIcon(MoodEnum[key], true)).not.toBeNull();
|
|
63
|
-
expect(getIcon(MoodEnum[key], false)).toBeNull();
|
|
73
|
+
expect(getIcon(wrapper, MoodEnum[key], true)).not.toBeNull();
|
|
74
|
+
expect(getIcon(wrapper, MoodEnum[key], false)).toBeNull();
|
|
64
75
|
} else {
|
|
65
|
-
expect(getIcon(MoodEnum[key], false)).not.toBeNull();
|
|
66
|
-
expect(getIcon(MoodEnum[key], true)).toBeNull();
|
|
76
|
+
expect(getIcon(wrapper, MoodEnum[key], false)).not.toBeNull();
|
|
77
|
+
expect(getIcon(wrapper, MoodEnum[key], true)).toBeNull();
|
|
67
78
|
}
|
|
68
79
|
});
|
|
69
80
|
},
|
|
70
81
|
);
|
|
71
82
|
|
|
72
83
|
test(`Deselecting selected icon by pressing it again`, (): void => {
|
|
73
|
-
let mockedStateMood: MoodEnum = MoodEnum.Happy;
|
|
74
|
-
const mockSelected = jest.fn(
|
|
84
|
+
let mockedStateMood: Logbook.Enums.MoodEnum = MoodEnum.Happy;
|
|
85
|
+
const mockSelected = jest.fn(
|
|
86
|
+
(newMood: Logbook.Enums.MoodEnum): Logbook.Enums.MoodEnum => (mockedStateMood = newMood),
|
|
87
|
+
);
|
|
75
88
|
|
|
76
89
|
const mood = MoodEnum[mockedStateMood];
|
|
77
90
|
|
|
78
91
|
const wrapper = render(<Emotion moodSelected={mockSelected} currentMood={mockedStateMood} />);
|
|
79
92
|
|
|
80
|
-
const getIcon = (name: string, active: boolean): void => wrapper.queryByA11yLabel(`${name}_${active}`);
|
|
81
|
-
|
|
82
93
|
// current mood has already been selected: Happy
|
|
83
|
-
expect(getIcon(mood, true)).not.toBeNull();
|
|
84
|
-
expect(getIcon(mood, false)).toBeNull();
|
|
94
|
+
expect(getIcon(wrapper, mood, true)).not.toBeNull();
|
|
95
|
+
expect(getIcon(wrapper, mood, false)).toBeNull();
|
|
96
|
+
|
|
97
|
+
const icon = getIcon(wrapper, mood, true);
|
|
98
|
+
|
|
99
|
+
if (icon === null) {
|
|
100
|
+
return fail(`No icon found for queryByA11yLabel: ${mood}_${true}`);
|
|
101
|
+
}
|
|
85
102
|
|
|
86
|
-
fireEvent(
|
|
103
|
+
fireEvent(icon, `onPress`);
|
|
87
104
|
|
|
88
105
|
wrapper.update(<Emotion moodSelected={mockSelected} currentMood={mockedStateMood} />);
|
|
89
106
|
|
|
90
|
-
expect(getIcon(mood, true)).toBeNull();
|
|
91
|
-
expect(getIcon(mood, false)).not.toBeNull();
|
|
107
|
+
expect(getIcon(wrapper, mood, true)).toBeNull();
|
|
108
|
+
expect(getIcon(wrapper, mood, false)).not.toBeNull();
|
|
92
109
|
});
|
|
93
110
|
});
|
|
File without changes
|
|
@@ -8,25 +8,26 @@ const react_native_testing_library_1 = require("react-native-testing-library");
|
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
const react_2 = require("@lingui/react");
|
|
10
10
|
const Header_1 = __importDefault(require("../../components/Header"));
|
|
11
|
+
const types_1 = require("@hedia/types");
|
|
11
12
|
const i18nUtils_1 = require("../../locale/i18nUtils");
|
|
12
13
|
const enum_1 = require("../../types/enum");
|
|
13
14
|
describe(`Header Component`, () => {
|
|
14
15
|
afterEach(react_native_testing_library_1.cleanup);
|
|
15
16
|
test(`Exit button calls exitCallback`, () => {
|
|
16
17
|
const props = utils_1.getRecommendationProps();
|
|
17
|
-
const {
|
|
18
|
+
const { getByTestId } = react_native_testing_library_1.render(<Header_1.default exitCallback={props.exitCallback}/>);
|
|
18
19
|
expect(props.exitCallback).not.toBeCalled();
|
|
19
|
-
react_native_testing_library_1.fireEvent.press(
|
|
20
|
+
react_native_testing_library_1.fireEvent.press(getByTestId(enum_1.HeaderTestIds.ExitCalculation));
|
|
20
21
|
expect(props.exitCallback).toBeCalled();
|
|
21
22
|
});
|
|
22
23
|
test.each `
|
|
23
|
-
language | locale
|
|
24
|
-
${`English`} | ${
|
|
25
|
-
${`Danish`} | ${
|
|
26
|
-
${`German`} | ${
|
|
27
|
-
${`Spanish`} | ${
|
|
28
|
-
${`Italian`} | ${
|
|
29
|
-
${`French`} | ${
|
|
24
|
+
language | locale | header
|
|
25
|
+
${`English`} | ${types_1.Languages.en} | ${`INSULIN\nRECOMMENDATION`}
|
|
26
|
+
${`Danish`} | ${types_1.Languages.da} | ${`INSULIN\nANBEFALING`}
|
|
27
|
+
${`German`} | ${types_1.Languages.de} | ${`INSULIN\nEMPFEHLUNG`}
|
|
28
|
+
${`Spanish`} | ${types_1.Languages.es} | ${`RECOMENDACIÓN\nDE INSULINA`}
|
|
29
|
+
${`Italian`} | ${types_1.Languages.it} | ${`PRESCRIZIONE DI\nINSULINA`}
|
|
30
|
+
${`French`} | ${types_1.Languages.fr} | ${`RECOMMANDATION\nD’INSULINE`}
|
|
30
31
|
`(`Header is translated to $language`, ({ header, locale }) => {
|
|
31
32
|
const props = utils_1.getRecommendationProps({
|
|
32
33
|
language: locale,
|
|
@@ -5,28 +5,29 @@ import { expectTextExists, getRecommendationProps } from "../utils";
|
|
|
5
5
|
import { I18nProvider } from "@lingui/react";
|
|
6
6
|
import Header from "../../components/Header";
|
|
7
7
|
|
|
8
|
+
import { Languages } from "@hedia/types";
|
|
8
9
|
import { i18n } from "../../locale/i18nUtils";
|
|
9
|
-
import {
|
|
10
|
+
import { HeaderTestIds } from "../../types/enum";
|
|
10
11
|
|
|
11
12
|
describe(`Header Component`, (): void => {
|
|
12
13
|
afterEach(cleanup);
|
|
13
14
|
|
|
14
15
|
test(`Exit button calls exitCallback`, (): void => {
|
|
15
16
|
const props = getRecommendationProps();
|
|
16
|
-
const {
|
|
17
|
+
const { getByTestId } = render(<Header exitCallback={props.exitCallback} />);
|
|
17
18
|
expect(props.exitCallback).not.toBeCalled();
|
|
18
|
-
fireEvent.press(
|
|
19
|
+
fireEvent.press(getByTestId(HeaderTestIds.ExitCalculation));
|
|
19
20
|
expect(props.exitCallback).toBeCalled();
|
|
20
21
|
});
|
|
21
22
|
test.each`
|
|
22
|
-
language | locale
|
|
23
|
-
${`English`} | ${
|
|
24
|
-
${`Danish`} | ${
|
|
25
|
-
${`German`} | ${
|
|
26
|
-
${`Spanish`} | ${
|
|
27
|
-
${`Italian`} | ${
|
|
28
|
-
${`French`} | ${
|
|
29
|
-
`(`Header is translated to $language`, ({ header, locale }: { locale:
|
|
23
|
+
language | locale | header
|
|
24
|
+
${`English`} | ${Languages.en} | ${`INSULIN\nRECOMMENDATION`}
|
|
25
|
+
${`Danish`} | ${Languages.da} | ${`INSULIN\nANBEFALING`}
|
|
26
|
+
${`German`} | ${Languages.de} | ${`INSULIN\nEMPFEHLUNG`}
|
|
27
|
+
${`Spanish`} | ${Languages.es} | ${`RECOMENDACIÓN\nDE INSULINA`}
|
|
28
|
+
${`Italian`} | ${Languages.it} | ${`PRESCRIZIONE DI\nINSULINA`}
|
|
29
|
+
${`French`} | ${Languages.fr} | ${`RECOMMANDATION\nD’INSULINE`}
|
|
30
|
+
`(`Header is translated to $language`, ({ header, locale }: { locale: Languages; header: string }): void => {
|
|
30
31
|
const props = getRecommendationProps({
|
|
31
32
|
language: locale,
|
|
32
33
|
});
|
|
File without changes
|
|
@@ -33,6 +33,7 @@ describe(`Info Bars Component`, () => {
|
|
|
33
33
|
label: `Active Insulin`,
|
|
34
34
|
unit: `units`,
|
|
35
35
|
showNullAsDash: true,
|
|
36
|
+
value: null,
|
|
36
37
|
};
|
|
37
38
|
const InfoBarsComponent = react_native_testing_library_1.render(<InfoBars_1.default {...props}/>);
|
|
38
39
|
utils_1.expectTextNotExists(InfoBarsComponent, `${types_1.BloodGlucoseUnit.MG_DL}`);
|
|
@@ -23,7 +23,7 @@ describe(`Info Bars Component`, (): void => {
|
|
|
23
23
|
expectTextNotExists(InfoBarsComponent, `${BloodGlucoseUnit.MMOL_L}`);
|
|
24
24
|
expectTextExists(InfoBarsComponent, props.label);
|
|
25
25
|
expectTextExists(InfoBarsComponent, `${props.unit}`);
|
|
26
|
-
expectTextExists(InfoBarsComponent, props.value);
|
|
26
|
+
expectTextExists(InfoBarsComponent, props.value!);
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
test(`Active Insulin info bar - showNullAsDash`, (): void => {
|
|
@@ -31,6 +31,7 @@ describe(`Info Bars Component`, (): void => {
|
|
|
31
31
|
label: `Active Insulin`,
|
|
32
32
|
unit: `units`,
|
|
33
33
|
showNullAsDash: true,
|
|
34
|
+
value: null,
|
|
34
35
|
};
|
|
35
36
|
const InfoBarsComponent = render(<InfoBars {...props} />);
|
|
36
37
|
expectTextNotExists(InfoBarsComponent, `${BloodGlucoseUnit.MG_DL}`);
|
|
@@ -50,7 +51,7 @@ describe(`Info Bars Component`, (): void => {
|
|
|
50
51
|
expectTextNotExists(InfoBarsComponent, `${BloodGlucoseUnit.MG_DL}`);
|
|
51
52
|
expectTextExists(InfoBarsComponent, props.label);
|
|
52
53
|
expectTextExists(InfoBarsComponent, `${props.unit}`);
|
|
53
|
-
expectTextExists(InfoBarsComponent, props.value);
|
|
54
|
+
expectTextExists(InfoBarsComponent, props.value!);
|
|
54
55
|
});
|
|
55
56
|
|
|
56
57
|
test(`Blood Glucose mmol/l can be displayed`, (): void => {
|
|
@@ -66,7 +67,7 @@ describe(`Info Bars Component`, (): void => {
|
|
|
66
67
|
|
|
67
68
|
expectTextExists(InfoBarsComponent, props.label);
|
|
68
69
|
expectTextExists(InfoBarsComponent, DisplayedUnit.MMOL_L);
|
|
69
|
-
expectTextExists(InfoBarsComponent, props.value);
|
|
70
|
+
expectTextExists(InfoBarsComponent, props.value!);
|
|
70
71
|
});
|
|
71
72
|
|
|
72
73
|
test(`Blood Glucose mg/dl can be displayed`, (): void => {
|
|
@@ -82,7 +83,7 @@ describe(`Info Bars Component`, (): void => {
|
|
|
82
83
|
|
|
83
84
|
expectTextExists(InfoBarsComponent, props.label);
|
|
84
85
|
expectTextExists(InfoBarsComponent, DisplayedUnit.MG_DL);
|
|
85
|
-
expectTextExists(InfoBarsComponent, props.value);
|
|
86
|
+
expectTextExists(InfoBarsComponent, props.value!);
|
|
86
87
|
});
|
|
87
88
|
|
|
88
89
|
test(`Blood Ketones mmol/l can be displayed`, (): void => {
|
|
@@ -98,7 +99,7 @@ describe(`Info Bars Component`, (): void => {
|
|
|
98
99
|
|
|
99
100
|
expectTextExists(InfoBarsComponent, props.label);
|
|
100
101
|
expectTextExists(InfoBarsComponent, DisplayedUnit.MMOL_L);
|
|
101
|
-
expectTextExists(InfoBarsComponent, props.value);
|
|
102
|
+
expectTextExists(InfoBarsComponent, props.value!);
|
|
102
103
|
});
|
|
103
104
|
|
|
104
105
|
test(`Blood Ketones mg/dl can be displayed`, (): void => {
|
|
@@ -114,7 +115,7 @@ describe(`Info Bars Component`, (): void => {
|
|
|
114
115
|
|
|
115
116
|
expectTextExists(InfoBarsComponent, props.label);
|
|
116
117
|
expectTextExists(InfoBarsComponent, DisplayedUnit.MG_DL);
|
|
117
|
-
expectTextExists(InfoBarsComponent, props.value);
|
|
118
|
+
expectTextExists(InfoBarsComponent, props.value!);
|
|
118
119
|
});
|
|
119
120
|
|
|
120
121
|
interface IShowNullAsDash {
|
|
File without changes
|