@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
|
@@ -12,10 +12,12 @@ describe(`InvisibleNumberInput Component`, () => {
|
|
|
12
12
|
const onEndMock = jest.fn();
|
|
13
13
|
const partialInputMock = jest.fn();
|
|
14
14
|
let callbackInput;
|
|
15
|
+
const TEST_ID = `invisible-number-input-test-id`;
|
|
15
16
|
const startValue = `24`;
|
|
16
|
-
const NumberInput = react_native_testing_library_1.render(<InvisibleNumberInput_1.default negativeAllowed={false} cleanPartialInput={true} decimalPlaces={0} onEnd={onEndMock} partialInput={partialInputMock} visible={(e) => (callbackInput = e)} startValue={startValue}/>);
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const NumberInput = react_native_testing_library_1.render(<InvisibleNumberInput_1.default negativeAllowed={false} cleanPartialInput={true} decimalPlaces={0} onEnd={onEndMock} partialInput={partialInputMock} visible={(e) => (callbackInput = e)} startValue={startValue} testID={TEST_ID}/>);
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
callbackInput?.();
|
|
20
|
+
const textInput = NumberInput.getByTestId(TEST_ID);
|
|
19
21
|
react_native_testing_library_1.fireEvent(textInput, `onEndEditing`);
|
|
20
22
|
expect(partialInputMock).not.toBeCalled();
|
|
21
23
|
expect(onEndMock).toBeCalledWith(Number(startValue));
|
|
@@ -24,9 +26,11 @@ describe(`InvisibleNumberInput Component`, () => {
|
|
|
24
26
|
const onEndMock = jest.fn();
|
|
25
27
|
const partialInputMock = jest.fn();
|
|
26
28
|
let callbackInput;
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
const TEST_ID = `invisible-number-input-test-id`;
|
|
30
|
+
const NumberInput = react_native_testing_library_1.render(<InvisibleNumberInput_1.default negativeAllowed={false} cleanPartialInput={true} decimalPlaces={0} onEnd={onEndMock} partialInput={partialInputMock} visible={(e) => (callbackInput = e)} testID={TEST_ID}/>);
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
callbackInput?.();
|
|
33
|
+
const textInput = NumberInput.getByTestId(TEST_ID);
|
|
30
34
|
react_native_testing_library_1.fireEvent(textInput, `onEndEditing`);
|
|
31
35
|
expect(partialInputMock).not.toBeCalled();
|
|
32
36
|
expect(onEndMock).toBeCalledWith(0);
|
|
@@ -43,9 +47,11 @@ describe(`InvisibleNumberInput Component`, () => {
|
|
|
43
47
|
const onEndMock = jest.fn();
|
|
44
48
|
const partialInputMock = jest.fn();
|
|
45
49
|
let callbackInput;
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
const TEST_ID = `invisible-number-input-test-id`;
|
|
51
|
+
const NumberInput = react_native_testing_library_1.render(<InvisibleNumberInput_1.default negativeAllowed={false} cleanPartialInput={true} decimalPlaces={0} onEnd={onEndMock} partialInput={partialInputMock} visible={(e) => (callbackInput = e)} testID={TEST_ID}/>);
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
callbackInput?.();
|
|
54
|
+
const textInput = NumberInput.getByTestId(TEST_ID);
|
|
49
55
|
react_native_testing_library_1.fireEvent(textInput, `onChangeText`, input);
|
|
50
56
|
expect(partialInputMock).toBeCalledWith(`${result}`);
|
|
51
57
|
expect(onEndMock).not.toBeCalled();
|
|
@@ -56,9 +62,11 @@ describe(`InvisibleNumberInput Component`, () => {
|
|
|
56
62
|
const onEndMock = jest.fn();
|
|
57
63
|
const partialInputMock = jest.fn();
|
|
58
64
|
let callbackInput;
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
const TEST_ID = `invisible-number-input-test-id`;
|
|
66
|
+
const NumberInput = react_native_testing_library_1.render(<InvisibleNumberInput_1.default negativeAllowed={false} cleanPartialInput={true} decimalPlaces={0} onEnd={onEndMock} partialInput={partialInputMock} visible={(e) => (callbackInput = e)} testID={TEST_ID}/>);
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
callbackInput?.();
|
|
69
|
+
const textInput = NumberInput.getByTestId(TEST_ID);
|
|
62
70
|
react_native_testing_library_1.fireEvent.changeText(textInput, `22`);
|
|
63
71
|
expect(partialInputMock).toBeCalledWith(`22`);
|
|
64
72
|
expect(onEndMock).not.toBeCalled();
|
|
@@ -79,9 +87,11 @@ describe(`InvisibleNumberInput Component`, () => {
|
|
|
79
87
|
const onEndMock = jest.fn();
|
|
80
88
|
const partialInputMock = jest.fn();
|
|
81
89
|
let callbackInput;
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
const TEST_ID = `invisible-number-input-test-id`;
|
|
91
|
+
const NumberInput = react_native_testing_library_1.render(<InvisibleNumberInput_1.default negativeAllowed={false} cleanPartialInput={true} decimalPlaces={decimals} onEnd={onEndMock} partialInput={partialInputMock} visible={(e) => (callbackInput = e)} startValue={startValue} testID={TEST_ID}/>);
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
callbackInput?.();
|
|
94
|
+
const textInput = NumberInput.getByTestId(TEST_ID);
|
|
85
95
|
react_native_testing_library_1.fireEvent(textInput, `onChangeText`, startValue);
|
|
86
96
|
expect(partialInputMock).toBeCalledWith(`${expected}`);
|
|
87
97
|
});
|
|
@@ -104,9 +114,11 @@ describe(`InvisibleNumberInput Component`, () => {
|
|
|
104
114
|
const onEndMock = jest.fn();
|
|
105
115
|
const partialInputMock = jest.fn();
|
|
106
116
|
let callbackInput;
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
117
|
+
const TEST_ID = `invisible-number-input-test-id`;
|
|
118
|
+
const NumberInput = react_native_testing_library_1.render(<InvisibleNumberInput_1.default negativeAllowed={false} cleanPartialInput={true} decimalPlaces={decimals} onEnd={onEndMock} partialInput={partialInputMock} visible={(e) => (callbackInput = e)} startValue={startValue} testID={TEST_ID}/>);
|
|
119
|
+
// @ts-ignore
|
|
120
|
+
callbackInput?.();
|
|
121
|
+
const textInput = NumberInput.getByTestId(TEST_ID);
|
|
110
122
|
react_native_testing_library_1.fireEvent(textInput, `onChangeText`, startValue);
|
|
111
123
|
expect(partialInputMock).toBeCalledWith(`${expected}`);
|
|
112
124
|
});
|
|
@@ -121,9 +133,11 @@ describe(`InvisibleNumberInput Component`, () => {
|
|
|
121
133
|
const onEndMock = jest.fn();
|
|
122
134
|
const partialInputMock = jest.fn();
|
|
123
135
|
let callbackInput;
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
136
|
+
const TEST_ID = `invisible-number-input-test-id`;
|
|
137
|
+
const NumberInput = react_native_testing_library_1.render(<InvisibleNumberInput_1.default negativeAllowed={false} cleanPartialInput={false} decimalPlaces={decimals} onEnd={onEndMock} partialInput={partialInputMock} visible={(e) => (callbackInput = e)} startValue={startValue} testID={TEST_ID}/>);
|
|
138
|
+
// @ts-ignore
|
|
139
|
+
callbackInput?.();
|
|
140
|
+
const textInput = NumberInput.getByTestId(TEST_ID);
|
|
127
141
|
react_native_testing_library_1.fireEvent(textInput, `onChangeText`, startValue);
|
|
128
142
|
expect(partialInputMock).toBeCalledWith(expected);
|
|
129
143
|
});
|
|
@@ -138,9 +152,11 @@ describe(`InvisibleNumberInput Component`, () => {
|
|
|
138
152
|
const onEndMock = jest.fn();
|
|
139
153
|
const partialInputMock = jest.fn();
|
|
140
154
|
let callbackInput;
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
155
|
+
const TEST_ID = `invisible-number-input-test-id`;
|
|
156
|
+
const NumberInput = react_native_testing_library_1.render(<InvisibleNumberInput_1.default negativeAllowed={true} cleanPartialInput={false} decimalPlaces={decimals} onEnd={onEndMock} partialInput={partialInputMock} visible={(e) => (callbackInput = e)} startValue={startValue} testID={TEST_ID}/>);
|
|
157
|
+
// @ts-ignore
|
|
158
|
+
callbackInput?.();
|
|
159
|
+
const textInput = NumberInput.getByTestId(TEST_ID);
|
|
144
160
|
react_native_testing_library_1.fireEvent(textInput, `onChangeText`, startValue);
|
|
145
161
|
expect(partialInputMock).toBeCalledWith(startValue);
|
|
146
162
|
react_native_testing_library_1.fireEvent(textInput, `onEndEditing`, startValue);
|
|
@@ -9,7 +9,7 @@ describe(`InvisibleNumberInput Component`, (): void => {
|
|
|
9
9
|
const onEndMock = jest.fn();
|
|
10
10
|
const partialInputMock = jest.fn();
|
|
11
11
|
let callbackInput: () => void;
|
|
12
|
-
|
|
12
|
+
const TEST_ID = `invisible-number-input-test-id`;
|
|
13
13
|
const startValue = `24`;
|
|
14
14
|
|
|
15
15
|
const NumberInput = render(
|
|
@@ -21,12 +21,14 @@ describe(`InvisibleNumberInput Component`, (): void => {
|
|
|
21
21
|
partialInput={partialInputMock}
|
|
22
22
|
visible={(e): (() => void) => (callbackInput = e)}
|
|
23
23
|
startValue={startValue}
|
|
24
|
+
testID={TEST_ID}
|
|
24
25
|
/>,
|
|
25
26
|
);
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
callbackInput?.();
|
|
28
30
|
|
|
29
|
-
const textInput = NumberInput.
|
|
31
|
+
const textInput = NumberInput.getByTestId(TEST_ID);
|
|
30
32
|
fireEvent(textInput, `onEndEditing`);
|
|
31
33
|
expect(partialInputMock).not.toBeCalled();
|
|
32
34
|
expect(onEndMock).toBeCalledWith(Number(startValue));
|
|
@@ -36,6 +38,7 @@ describe(`InvisibleNumberInput Component`, (): void => {
|
|
|
36
38
|
const onEndMock = jest.fn();
|
|
37
39
|
const partialInputMock = jest.fn();
|
|
38
40
|
let callbackInput: () => void;
|
|
41
|
+
const TEST_ID = `invisible-number-input-test-id`;
|
|
39
42
|
|
|
40
43
|
const NumberInput = render(
|
|
41
44
|
<InvisibleNumberInput
|
|
@@ -45,12 +48,14 @@ describe(`InvisibleNumberInput Component`, (): void => {
|
|
|
45
48
|
onEnd={onEndMock}
|
|
46
49
|
partialInput={partialInputMock}
|
|
47
50
|
visible={(e): (() => void) => (callbackInput = e)}
|
|
51
|
+
testID={TEST_ID}
|
|
48
52
|
/>,
|
|
49
53
|
);
|
|
50
54
|
|
|
51
|
-
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
callbackInput?.();
|
|
52
57
|
|
|
53
|
-
const textInput = NumberInput.
|
|
58
|
+
const textInput = NumberInput.getByTestId(TEST_ID);
|
|
54
59
|
fireEvent(textInput, `onEndEditing`);
|
|
55
60
|
expect(partialInputMock).not.toBeCalled();
|
|
56
61
|
expect(onEndMock).toBeCalledWith(0);
|
|
@@ -68,6 +73,7 @@ describe(`InvisibleNumberInput Component`, (): void => {
|
|
|
68
73
|
const onEndMock = jest.fn();
|
|
69
74
|
const partialInputMock = jest.fn();
|
|
70
75
|
let callbackInput: () => void;
|
|
76
|
+
const TEST_ID = `invisible-number-input-test-id`;
|
|
71
77
|
|
|
72
78
|
const NumberInput = render(
|
|
73
79
|
<InvisibleNumberInput
|
|
@@ -77,12 +83,14 @@ describe(`InvisibleNumberInput Component`, (): void => {
|
|
|
77
83
|
onEnd={onEndMock}
|
|
78
84
|
partialInput={partialInputMock}
|
|
79
85
|
visible={(e): (() => void) => (callbackInput = e)}
|
|
86
|
+
testID={TEST_ID}
|
|
80
87
|
/>,
|
|
81
88
|
);
|
|
82
89
|
|
|
83
|
-
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
callbackInput?.();
|
|
84
92
|
|
|
85
|
-
const textInput = NumberInput.
|
|
93
|
+
const textInput = NumberInput.getByTestId(TEST_ID);
|
|
86
94
|
fireEvent(textInput, `onChangeText`, input);
|
|
87
95
|
expect(partialInputMock).toBeCalledWith(`${result}`);
|
|
88
96
|
expect(onEndMock).not.toBeCalled();
|
|
@@ -94,6 +102,8 @@ describe(`InvisibleNumberInput Component`, (): void => {
|
|
|
94
102
|
const onEndMock = jest.fn();
|
|
95
103
|
const partialInputMock = jest.fn();
|
|
96
104
|
let callbackInput: () => void;
|
|
105
|
+
const TEST_ID = `invisible-number-input-test-id`;
|
|
106
|
+
|
|
97
107
|
const NumberInput = render(
|
|
98
108
|
<InvisibleNumberInput
|
|
99
109
|
negativeAllowed={false}
|
|
@@ -102,12 +112,14 @@ describe(`InvisibleNumberInput Component`, (): void => {
|
|
|
102
112
|
onEnd={onEndMock}
|
|
103
113
|
partialInput={partialInputMock}
|
|
104
114
|
visible={(e): (() => void) => (callbackInput = e)}
|
|
115
|
+
testID={TEST_ID}
|
|
105
116
|
/>,
|
|
106
117
|
);
|
|
107
118
|
|
|
108
|
-
|
|
119
|
+
// @ts-ignore
|
|
120
|
+
callbackInput?.();
|
|
109
121
|
|
|
110
|
-
const textInput = NumberInput.
|
|
122
|
+
const textInput = NumberInput.getByTestId(TEST_ID);
|
|
111
123
|
fireEvent.changeText(textInput, `22`);
|
|
112
124
|
expect(partialInputMock).toBeCalledWith(`22`);
|
|
113
125
|
expect(onEndMock).not.toBeCalled();
|
|
@@ -137,6 +149,7 @@ describe(`InvisibleNumberInput Component`, (): void => {
|
|
|
137
149
|
const onEndMock = jest.fn();
|
|
138
150
|
const partialInputMock = jest.fn();
|
|
139
151
|
let callbackInput: () => void;
|
|
152
|
+
const TEST_ID = `invisible-number-input-test-id`;
|
|
140
153
|
|
|
141
154
|
const NumberInput = render(
|
|
142
155
|
<InvisibleNumberInput
|
|
@@ -147,12 +160,14 @@ describe(`InvisibleNumberInput Component`, (): void => {
|
|
|
147
160
|
partialInput={partialInputMock}
|
|
148
161
|
visible={(e): (() => void) => (callbackInput = e)}
|
|
149
162
|
startValue={startValue}
|
|
163
|
+
testID={TEST_ID}
|
|
150
164
|
/>,
|
|
151
165
|
);
|
|
152
166
|
|
|
153
|
-
|
|
167
|
+
// @ts-ignore
|
|
168
|
+
callbackInput?.();
|
|
154
169
|
|
|
155
|
-
const textInput = NumberInput.
|
|
170
|
+
const textInput = NumberInput.getByTestId(TEST_ID);
|
|
156
171
|
fireEvent(textInput, `onChangeText`, startValue);
|
|
157
172
|
expect(partialInputMock).toBeCalledWith(`${expected}`);
|
|
158
173
|
},
|
|
@@ -179,6 +194,7 @@ describe(`InvisibleNumberInput Component`, (): void => {
|
|
|
179
194
|
const onEndMock = jest.fn();
|
|
180
195
|
const partialInputMock = jest.fn();
|
|
181
196
|
let callbackInput: () => void;
|
|
197
|
+
const TEST_ID = `invisible-number-input-test-id`;
|
|
182
198
|
|
|
183
199
|
const NumberInput = render(
|
|
184
200
|
<InvisibleNumberInput
|
|
@@ -189,12 +205,14 @@ describe(`InvisibleNumberInput Component`, (): void => {
|
|
|
189
205
|
partialInput={partialInputMock}
|
|
190
206
|
visible={(e): (() => void) => (callbackInput = e)}
|
|
191
207
|
startValue={startValue}
|
|
208
|
+
testID={TEST_ID}
|
|
192
209
|
/>,
|
|
193
210
|
);
|
|
194
211
|
|
|
195
|
-
|
|
212
|
+
// @ts-ignore
|
|
213
|
+
callbackInput?.();
|
|
196
214
|
|
|
197
|
-
const textInput = NumberInput.
|
|
215
|
+
const textInput = NumberInput.getByTestId(TEST_ID);
|
|
198
216
|
fireEvent(textInput, `onChangeText`, startValue);
|
|
199
217
|
expect(partialInputMock).toBeCalledWith(`${expected}`);
|
|
200
218
|
},
|
|
@@ -211,6 +229,7 @@ describe(`InvisibleNumberInput Component`, (): void => {
|
|
|
211
229
|
const onEndMock = jest.fn();
|
|
212
230
|
const partialInputMock = jest.fn();
|
|
213
231
|
let callbackInput: () => void;
|
|
232
|
+
const TEST_ID = `invisible-number-input-test-id`;
|
|
214
233
|
|
|
215
234
|
const NumberInput = render(
|
|
216
235
|
<InvisibleNumberInput
|
|
@@ -221,12 +240,14 @@ describe(`InvisibleNumberInput Component`, (): void => {
|
|
|
221
240
|
partialInput={partialInputMock}
|
|
222
241
|
visible={(e): (() => void) => (callbackInput = e)}
|
|
223
242
|
startValue={startValue}
|
|
243
|
+
testID={TEST_ID}
|
|
224
244
|
/>,
|
|
225
245
|
);
|
|
226
246
|
|
|
227
|
-
|
|
247
|
+
// @ts-ignore
|
|
248
|
+
callbackInput?.();
|
|
228
249
|
|
|
229
|
-
const textInput = NumberInput.
|
|
250
|
+
const textInput = NumberInput.getByTestId(TEST_ID);
|
|
230
251
|
fireEvent(textInput, `onChangeText`, startValue);
|
|
231
252
|
expect(partialInputMock).toBeCalledWith(expected);
|
|
232
253
|
});
|
|
@@ -244,6 +265,7 @@ describe(`InvisibleNumberInput Component`, (): void => {
|
|
|
244
265
|
const onEndMock = jest.fn();
|
|
245
266
|
const partialInputMock = jest.fn();
|
|
246
267
|
let callbackInput: () => void;
|
|
268
|
+
const TEST_ID = `invisible-number-input-test-id`;
|
|
247
269
|
|
|
248
270
|
const NumberInput = render(
|
|
249
271
|
<InvisibleNumberInput
|
|
@@ -254,12 +276,14 @@ describe(`InvisibleNumberInput Component`, (): void => {
|
|
|
254
276
|
partialInput={partialInputMock}
|
|
255
277
|
visible={(e): (() => void) => (callbackInput = e)}
|
|
256
278
|
startValue={startValue}
|
|
279
|
+
testID={TEST_ID}
|
|
257
280
|
/>,
|
|
258
281
|
);
|
|
259
282
|
|
|
260
|
-
|
|
283
|
+
// @ts-ignore
|
|
284
|
+
callbackInput?.();
|
|
261
285
|
|
|
262
|
-
const textInput = NumberInput.
|
|
286
|
+
const textInput = NumberInput.getByTestId(TEST_ID);
|
|
263
287
|
fireEvent(textInput, `onChangeText`, startValue);
|
|
264
288
|
expect(partialInputMock).toBeCalledWith(startValue);
|
|
265
289
|
|
|
File without changes
|
|
@@ -1,28 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
4
|
};
|
|
24
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const
|
|
6
|
+
const types_1 = require("@hedia/types");
|
|
26
7
|
const react_1 = require("@lingui/react");
|
|
27
8
|
const react_2 = __importDefault(require("react"));
|
|
28
9
|
const react_native_testing_library_1 = require("react-native-testing-library");
|
|
@@ -31,10 +12,11 @@ const i18nUtils_1 = require("../../locale/i18nUtils");
|
|
|
31
12
|
const enum_1 = require("../../types/enum");
|
|
32
13
|
const AttentionMessages_1 = require("../../utils/AttentionMessages");
|
|
33
14
|
const utils_1 = require("../utils");
|
|
15
|
+
const SAFETY_INSULIN_LIMIT = types_1.BolusCalculator.Constants.SAFETY_INSULIN_LIMIT;
|
|
34
16
|
describe(`Info Bars Component`, () => {
|
|
35
17
|
afterEach(react_native_testing_library_1.cleanup);
|
|
36
18
|
beforeEach(() => {
|
|
37
|
-
i18nUtils_1.i18n.activate(
|
|
19
|
+
i18nUtils_1.i18n.activate(types_1.Languages.en);
|
|
38
20
|
});
|
|
39
21
|
test(`Can call the callback`, () => {
|
|
40
22
|
const onPressNextButton = jest.fn();
|
|
@@ -43,19 +25,18 @@ describe(`Info Bars Component`, () => {
|
|
|
43
25
|
onPressNextButton,
|
|
44
26
|
};
|
|
45
27
|
const limitationMessage = react_native_testing_library_1.render(<LimitationMessage_1.default {...props}/>);
|
|
46
|
-
const nextButton = limitationMessage.
|
|
47
|
-
expect(nextButton).not.toBeNull();
|
|
28
|
+
const nextButton = limitationMessage.getByTestId(enum_1.LimitationMessageTestIds.OkButton);
|
|
48
29
|
react_native_testing_library_1.fireEvent(nextButton, `onPress`);
|
|
49
30
|
expect(onPressNextButton).toBeCalled();
|
|
50
31
|
});
|
|
51
32
|
test.each `
|
|
52
|
-
language | locale
|
|
53
|
-
${`English`} | ${
|
|
54
|
-
${`Danish`} | ${
|
|
55
|
-
${`German`} | ${
|
|
56
|
-
${`Spanish`} | ${
|
|
57
|
-
${`Italian`} | ${
|
|
58
|
-
${`French`} | ${
|
|
33
|
+
language | locale | message
|
|
34
|
+
${`English`} | ${types_1.Languages.en} | ${`Your recommendation would have been higher than ${SAFETY_INSULIN_LIMIT} units of insulin, but it has been limited for safety reasons. Hedia never recommends more than ${SAFETY_INSULIN_LIMIT} units of insulin per calculation.`}
|
|
35
|
+
${`Danish`} | ${types_1.Languages.da} | ${`Din anbefaling ville have været højere end ${SAFETY_INSULIN_LIMIT} units af insulin, men den er blevet begrænset af sikkerhedshensyn. Hedia anbefaler aldrig mere end ${SAFETY_INSULIN_LIMIT} units af insulin per beregning.`}
|
|
36
|
+
${`German`} | ${types_1.Languages.de} | ${`Ihre Empfehlung wäre höher als ${SAFETY_INSULIN_LIMIT} Einheiten Insulin gewesen, aber sie wurde aus Sicherheitsgründen begrenzt. Hedia empfiehlt nie mehr als ${SAFETY_INSULIN_LIMIT} Einheiten Insulin pro Berechnung.`}
|
|
37
|
+
${`Spanish`} | ${types_1.Languages.es} | ${`Su recomendación habría sido superior a ${SAFETY_INSULIN_LIMIT} unidades de insulina, pero se ha limitado por razones de seguridad. Hedia nunca recomienda más de ${SAFETY_INSULIN_LIMIT} unidades de insulina por calculación.`}
|
|
38
|
+
${`Italian`} | ${types_1.Languages.it} | ${`La tua prescrizione sarebbe stata superiore a ${SAFETY_INSULIN_LIMIT} unità di insulina, ma è stata limitata per motivi di sicurezza. Hedia non prescrive mai più di ${SAFETY_INSULIN_LIMIT} unità di insulina per calcolo.`}
|
|
39
|
+
${`French`} | ${types_1.Languages.fr} | ${`Votre recommandation aurait été supérieure à ${SAFETY_INSULIN_LIMIT} unités d’insuline, mais elle a été limitée pour des raisons de sécurité. Hedia ne recommande jamais plus de ${SAFETY_INSULIN_LIMIT} unités d’insuline par calcul.`}
|
|
59
40
|
`(`Can display limitation message in $language`, ({ message, locale }) => {
|
|
60
41
|
i18nUtils_1.i18n.activate(locale);
|
|
61
42
|
const onPressNextButton = jest.fn();
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BolusCalculator, Languages } from "@hedia/types";
|
|
2
2
|
import { I18nProvider } from "@lingui/react";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { cleanup, fireEvent, render } from "react-native-testing-library";
|
|
5
5
|
import LimitationMessage, { ILimitationMessageProps } from "../../components/LimitationMessage";
|
|
6
6
|
import { i18n } from "../../locale/i18nUtils";
|
|
7
|
-
import {
|
|
7
|
+
import { LimitationMessageTestIds } from "../../types/enum";
|
|
8
8
|
import { Messages } from "../../utils/AttentionMessages";
|
|
9
9
|
import { expectTextExists } from "../utils";
|
|
10
10
|
|
|
11
|
+
const SAFETY_INSULIN_LIMIT = BolusCalculator.Constants.SAFETY_INSULIN_LIMIT;
|
|
12
|
+
|
|
11
13
|
describe(`Info Bars Component`, (): void => {
|
|
12
14
|
afterEach(cleanup);
|
|
13
15
|
beforeEach((): void => {
|
|
14
|
-
i18n.activate(
|
|
16
|
+
i18n.activate(Languages.en);
|
|
15
17
|
});
|
|
16
18
|
|
|
17
19
|
test(`Can call the callback`, (): void => {
|
|
@@ -21,23 +23,23 @@ describe(`Info Bars Component`, (): void => {
|
|
|
21
23
|
onPressNextButton,
|
|
22
24
|
};
|
|
23
25
|
const limitationMessage = render(<LimitationMessage {...props} />);
|
|
24
|
-
const nextButton = limitationMessage.
|
|
25
|
-
|
|
26
|
+
const nextButton = limitationMessage.getByTestId(LimitationMessageTestIds.OkButton);
|
|
27
|
+
|
|
26
28
|
fireEvent(nextButton, `onPress`);
|
|
27
29
|
expect(onPressNextButton).toBeCalled();
|
|
28
30
|
});
|
|
29
31
|
|
|
30
32
|
test.each`
|
|
31
|
-
language | locale
|
|
32
|
-
${`English`} | ${
|
|
33
|
-
${`Danish`} | ${
|
|
34
|
-
${`German`} | ${
|
|
35
|
-
${`Spanish`} | ${
|
|
36
|
-
${`Italian`} | ${
|
|
37
|
-
${`French`} | ${
|
|
33
|
+
language | locale | message
|
|
34
|
+
${`English`} | ${Languages.en} | ${`Your recommendation would have been higher than ${SAFETY_INSULIN_LIMIT} units of insulin, but it has been limited for safety reasons. Hedia never recommends more than ${SAFETY_INSULIN_LIMIT} units of insulin per calculation.`}
|
|
35
|
+
${`Danish`} | ${Languages.da} | ${`Din anbefaling ville have været højere end ${SAFETY_INSULIN_LIMIT} units af insulin, men den er blevet begrænset af sikkerhedshensyn. Hedia anbefaler aldrig mere end ${SAFETY_INSULIN_LIMIT} units af insulin per beregning.`}
|
|
36
|
+
${`German`} | ${Languages.de} | ${`Ihre Empfehlung wäre höher als ${SAFETY_INSULIN_LIMIT} Einheiten Insulin gewesen, aber sie wurde aus Sicherheitsgründen begrenzt. Hedia empfiehlt nie mehr als ${SAFETY_INSULIN_LIMIT} Einheiten Insulin pro Berechnung.`}
|
|
37
|
+
${`Spanish`} | ${Languages.es} | ${`Su recomendación habría sido superior a ${SAFETY_INSULIN_LIMIT} unidades de insulina, pero se ha limitado por razones de seguridad. Hedia nunca recomienda más de ${SAFETY_INSULIN_LIMIT} unidades de insulina por calculación.`}
|
|
38
|
+
${`Italian`} | ${Languages.it} | ${`La tua prescrizione sarebbe stata superiore a ${SAFETY_INSULIN_LIMIT} unità di insulina, ma è stata limitata per motivi di sicurezza. Hedia non prescrive mai più di ${SAFETY_INSULIN_LIMIT} unità di insulina per calcolo.`}
|
|
39
|
+
${`French`} | ${Languages.fr} | ${`Votre recommandation aurait été supérieure à ${SAFETY_INSULIN_LIMIT} unités d’insuline, mais elle a été limitée pour des raisons de sécurité. Hedia ne recommande jamais plus de ${SAFETY_INSULIN_LIMIT} unités d’insuline par calcul.`}
|
|
38
40
|
`(
|
|
39
41
|
`Can display limitation message in $language`,
|
|
40
|
-
({ message, locale }: { locale:
|
|
42
|
+
({ message, locale }: { locale: Languages; message: string }): void => {
|
|
41
43
|
i18n.activate(locale);
|
|
42
44
|
const onPressNextButton = jest.fn();
|
|
43
45
|
const props: ILimitationMessageProps = {
|
|
File without changes
|
|
@@ -3,26 +3,30 @@ 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 MoodIcon_1 = __importDefault(require("../../components/mood/MoodIcon"));
|
|
9
|
-
const
|
|
10
|
+
const MoodEnum = types_1.Logbook.Enums.MoodEnum;
|
|
10
11
|
describe(`MoodIcon - Component`, () => {
|
|
11
12
|
afterEach(react_native_testing_library_1.cleanup);
|
|
12
13
|
test.each `
|
|
13
14
|
mood | moodName
|
|
14
|
-
${
|
|
15
|
-
${
|
|
16
|
-
${
|
|
17
|
-
${
|
|
18
|
-
${
|
|
15
|
+
${MoodEnum.Happy} | ${MoodEnum[MoodEnum.Happy]}
|
|
16
|
+
${MoodEnum.SemiHappy} | ${MoodEnum[MoodEnum.SemiHappy]}
|
|
17
|
+
${MoodEnum.Neutral} | ${MoodEnum[MoodEnum.Neutral]}
|
|
18
|
+
${MoodEnum.SemiSad} | ${MoodEnum[MoodEnum.SemiSad]}
|
|
19
|
+
${MoodEnum.Sad} | ${MoodEnum[MoodEnum.Sad]}
|
|
19
20
|
`(`Mounting $moodName smiley is mounted inactive and can be toggled on`, ({ mood, moodName }) => {
|
|
20
21
|
let active = false;
|
|
21
22
|
const onPressMock = jest.fn((toggle) => (active = toggle));
|
|
22
23
|
const wrapper = react_native_testing_library_1.render(<MoodIcon_1.default active={active} mood={mood} onPress={onPressMock}/>);
|
|
23
24
|
const getButton = (isActive) => wrapper.getByA11yLabel(`${moodName}_${isActive}`);
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
const button = getButton(false);
|
|
26
|
+
if (button === null) {
|
|
27
|
+
return fail(`No button found for getByA11yLabel: ${moodName}_${false}`);
|
|
28
|
+
}
|
|
29
|
+
react_native_testing_library_1.fireEvent(button, `onPress`);
|
|
26
30
|
expect(onPressMock).toBeCalledWith(true);
|
|
27
31
|
expect(active).toBe(true);
|
|
28
32
|
wrapper.rerender(<MoodIcon_1.default active={active} mood={mood} onPress={onPressMock}/>);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { Logbook } from "@hedia/types";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { cleanup, fireEvent, render } from "react-native-testing-library";
|
|
4
|
+
import { ReactTestInstance } from "react-test-renderer";
|
|
3
5
|
import MoodIcon from "../../components/mood/MoodIcon";
|
|
4
|
-
|
|
6
|
+
|
|
7
|
+
const MoodEnum = Logbook.Enums.MoodEnum;
|
|
5
8
|
|
|
6
9
|
describe(`MoodIcon - Component`, (): void => {
|
|
7
10
|
afterEach(cleanup);
|
|
@@ -15,16 +18,21 @@ describe(`MoodIcon - Component`, (): void => {
|
|
|
15
18
|
${MoodEnum.Sad} | ${MoodEnum[MoodEnum.Sad]}
|
|
16
19
|
`(
|
|
17
20
|
`Mounting $moodName smiley is mounted inactive and can be toggled on`,
|
|
18
|
-
({ mood, moodName }: { mood: MoodEnum; moodName: string }): void => {
|
|
21
|
+
({ mood, moodName }: { mood: Logbook.Enums.MoodEnum; moodName: string }): void => {
|
|
19
22
|
let active = false;
|
|
20
23
|
const onPressMock = jest.fn((toggle): boolean => (active = toggle));
|
|
21
24
|
const wrapper = render(<MoodIcon active={active} mood={mood} onPress={onPressMock} />);
|
|
22
25
|
|
|
23
|
-
const getButton = (isActive: boolean):
|
|
26
|
+
const getButton = (isActive: boolean): ReactTestInstance | null =>
|
|
27
|
+
wrapper.getByA11yLabel(`${moodName}_${isActive}`);
|
|
28
|
+
|
|
29
|
+
const button = getButton(false);
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
if (button === null) {
|
|
32
|
+
return fail(`No button found for getByA11yLabel: ${moodName}_${false}`);
|
|
33
|
+
}
|
|
26
34
|
|
|
27
|
-
fireEvent(
|
|
35
|
+
fireEvent(button, `onPress`);
|
|
28
36
|
|
|
29
37
|
expect(onPressMock).toBeCalledWith(true);
|
|
30
38
|
expect(active).toBe(true);
|
|
File without changes
|