@hedia/recommendation-screen 2.1.33 → 2.1.34-alpha.0
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/ios/HediaRecommendationScreen.xcodeproj/project.pbxproj +2 -2
- package/ios/Podfile.lock +207 -207
- package/package.json +1 -1
- package/index.d.ts +0 -5
- package/index.js +0 -5
- package/src/RecommendationScreen.d.ts +0 -413
- package/src/RecommendationScreen.js +0 -493
- package/src/__tests__/RecommendationScreen.test.d.ts +0 -1
- package/src/__tests__/RecommendationScreen.test.js +0 -965
- package/src/__tests__/RecommendationUtils.test.d.ts +0 -1
- package/src/__tests__/RecommendationUtils.test.js +0 -216
- package/src/__tests__/Translate.test.d.ts +0 -1
- package/src/__tests__/Translate.test.js +0 -27
- package/src/__tests__/Utils.test.d.ts +0 -1
- package/src/__tests__/Utils.test.js +0 -66
- package/src/__tests__/Validations.test.d.ts +0 -1
- package/src/__tests__/Validations.test.js +0 -465
- package/src/__tests__/components/Activity.test.d.ts +0 -1
- package/src/__tests__/components/Activity.test.js +0 -86
- package/src/__tests__/components/Emotion.test.d.ts +0 -1
- package/src/__tests__/components/Emotion.test.js +0 -70
- package/src/__tests__/components/Header.test.d.ts +0 -1
- package/src/__tests__/components/Header.test.js +0 -36
- package/src/__tests__/components/InfoBars.test.d.ts +0 -1
- package/src/__tests__/components/InfoBars.test.js +0 -130
- package/src/__tests__/components/InvisibleNumberInput.test.d.ts +0 -1
- package/src/__tests__/components/InvisibleNumberInput.test.js +0 -160
- package/src/__tests__/components/LimitationMessage.test.d.ts +0 -1
- package/src/__tests__/components/LimitationMessage.test.js +0 -47
- package/src/__tests__/components/MoodIcon.test.d.ts +0 -1
- package/src/__tests__/components/MoodIcon.test.js +0 -30
- package/src/__tests__/components/RecommendationModal.test.d.ts +0 -1
- package/src/__tests__/components/RecommendationModal.test.js +0 -98
- package/src/__tests__/components/RecommendedCarbs.test.d.ts +0 -1
- package/src/__tests__/components/RecommendedCarbs.test.js +0 -120
- package/src/__tests__/components/RecommendedInsulin.test.d.ts +0 -1
- package/src/__tests__/components/RecommendedInsulin.test.js +0 -154
- package/src/__tests__/components/Remeasure.test.d.ts +0 -1
- package/src/__tests__/components/Remeasure.test.js +0 -78
- package/src/__tests__/components/TransferToLogbook.test.d.ts +0 -1
- package/src/__tests__/components/TransferToLogbook.test.js +0 -30
- package/src/__tests__/components/TwoOptionModal.test.d.ts +0 -1
- package/src/__tests__/components/TwoOptionModal.test.js +0 -65
- package/src/__tests__/utils.d.ts +0 -16
- package/src/__tests__/utils.js +0 -126
- package/src/components/Header.d.ts +0 -10
- package/src/components/Header.js +0 -75
- package/src/components/Icon.d.ts +0 -20
- package/src/components/Icon.js +0 -41
- package/src/components/InfoBars.d.ts +0 -103
- package/src/components/InfoBars.js +0 -129
- package/src/components/InvisibleNumberInput.d.ts +0 -89
- package/src/components/InvisibleNumberInput.js +0 -122
- package/src/components/LimitationMessage.d.ts +0 -14
- package/src/components/LimitationMessage.js +0 -31
- package/src/components/LineSeparator.d.ts +0 -10
- package/src/components/LineSeparator.js +0 -18
- package/src/components/RecentInsulin.d.ts +0 -17
- package/src/components/RecentInsulin.js +0 -94
- package/src/components/RecommendationModal.d.ts +0 -207
- package/src/components/RecommendationModal.js +0 -213
- package/src/components/RecommendedCarbs.d.ts +0 -94
- package/src/components/RecommendedCarbs.js +0 -251
- package/src/components/RecommendedInsulin.d.ts +0 -84
- package/src/components/RecommendedInsulin.js +0 -170
- package/src/components/Remeasure.d.ts +0 -49
- package/src/components/Remeasure.js +0 -125
- package/src/components/TransferToLogbook.d.ts +0 -34
- package/src/components/TransferToLogbook.js +0 -94
- package/src/components/TwoOptionModal.d.ts +0 -145
- package/src/components/TwoOptionModal.js +0 -148
- package/src/components/activity/Activity.d.ts +0 -26
- package/src/components/activity/Activity.js +0 -80
- package/src/components/activity/ActivityIcon.d.ts +0 -22
- package/src/components/activity/ActivityIcon.js +0 -58
- package/src/components/activity/ActivityIntensity.d.ts +0 -16
- package/src/components/activity/ActivityIntensity.js +0 -59
- package/src/components/mood/Emotion.d.ts +0 -38
- package/src/components/mood/Emotion.js +0 -65
- package/src/components/mood/MoodIcon.d.ts +0 -40
- package/src/components/mood/MoodIcon.js +0 -66
- package/src/locale/i18nUtils.d.ts +0 -18
- package/src/locale/i18nUtils.js +0 -39
- package/src/types/enum.d.ts +0 -122
- package/src/types/enum.js +0 -138
- package/src/types/types.d.ts +0 -17
- package/src/types/types.js +0 -1
- package/src/utils/AttentionMessages.d.ts +0 -96
- package/src/utils/AttentionMessages.js +0 -118
- package/src/utils/Constants.d.ts +0 -47
- package/src/utils/Constants.js +0 -47
- package/src/utils/RecommendationError.d.ts +0 -56
- package/src/utils/RecommendationError.js +0 -62
- package/src/utils/RecommendationUtils.d.ts +0 -100
- package/src/utils/RecommendationUtils.js +0 -199
- package/src/utils/Translations.d.ts +0 -9
- package/src/utils/Translations.js +0 -14
- package/src/utils/Utils.d.ts +0 -105
- package/src/utils/Utils.js +0 -141
- package/src/utils/Validations.d.ts +0 -250
- package/src/utils/Validations.js +0 -409
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { Activity, Milliseconds } from "@hedia/types";
|
|
2
|
-
import { BgLevel, RecommendationReminders } from "../types/enum";
|
|
3
|
-
import { addPostponeActivityMessageUnder5MMOL, AttentionMessage, Messages } from "../utils/AttentionMessages";
|
|
4
|
-
import { CurrentBGLError } from "../utils/RecommendationError";
|
|
5
|
-
import { getAttentionMessage, getBGLevel, getLimitationMessage, getReminder, isActivityWithin15Minutes, isSevereHyperglycemia, } from "../utils/RecommendationUtils";
|
|
6
|
-
import { generateDefaultActivitySettings, generateDefaultLogbook } from "./utils";
|
|
7
|
-
const ActivityIntensity = Activity.Enums.ActivityIntensity;
|
|
8
|
-
const { moderate } = ActivityIntensity;
|
|
9
|
-
describe(`Actions based on the blood glucose level:: InsulinSettingsUtils `, () => {
|
|
10
|
-
const logbookUnder15MMOL = {
|
|
11
|
-
...generateDefaultLogbook(),
|
|
12
|
-
blood_glucose_millimolar: 14.9,
|
|
13
|
-
};
|
|
14
|
-
const logbookOver15MMOL = {
|
|
15
|
-
...generateDefaultLogbook(),
|
|
16
|
-
blood_glucose_millimolar: 15.1,
|
|
17
|
-
};
|
|
18
|
-
const logbookWithNullBloodGlucose = {
|
|
19
|
-
...generateDefaultLogbook(),
|
|
20
|
-
blood_glucose_millimolar: null,
|
|
21
|
-
};
|
|
22
|
-
const inactiveDate = new Date(Date.now() + Milliseconds.Minute * 15.1);
|
|
23
|
-
const activeDate = new Date();
|
|
24
|
-
const activeActivity = {
|
|
25
|
-
activityDate: activeDate,
|
|
26
|
-
activityDuration: 10,
|
|
27
|
-
activityIntensity: moderate,
|
|
28
|
-
activitySettings: generateDefaultActivitySettings(),
|
|
29
|
-
};
|
|
30
|
-
const inactiveActivity = { ...activeActivity, activityDate: inactiveDate };
|
|
31
|
-
it.each `
|
|
32
|
-
bloodGlucoseValue | latestLogbookFrom6Hours | bgLevel
|
|
33
|
-
${1} | ${null} | ${BgLevel.UnsupportedBGLevel}
|
|
34
|
-
${33.4} | ${logbookOver15MMOL} | ${BgLevel.UnsupportedBGLevel}
|
|
35
|
-
${1.1} | ${null} | ${BgLevel.SevereHypoglycemia}
|
|
36
|
-
${2} | ${logbookOver15MMOL} | ${BgLevel.SevereHypoglycemia}
|
|
37
|
-
${3.5} | ${logbookOver15MMOL} | ${BgLevel.Hypoglycemia}
|
|
38
|
-
${3.6} | ${null} | ${BgLevel.MildHypoglycemia}
|
|
39
|
-
${4} | ${logbookOver15MMOL} | ${BgLevel.MildHypoglycemia}
|
|
40
|
-
${4.1} | ${null} | ${BgLevel.NormoglycemiaUnder5MMOL}
|
|
41
|
-
${5} | ${logbookUnder15MMOL} | ${BgLevel.Normoglycemia}
|
|
42
|
-
${9} | ${null} | ${BgLevel.MildHyperglycemia}
|
|
43
|
-
${15} | ${logbookOver15MMOL} | ${BgLevel.Hyperglycemia}
|
|
44
|
-
${15.1} | ${null} | ${BgLevel.Hyperglycemia}
|
|
45
|
-
${15.1} | ${logbookUnder15MMOL} | ${BgLevel.Hyperglycemia}
|
|
46
|
-
${27.2} | ${null} | ${BgLevel.Hyperglycemia}
|
|
47
|
-
${15.1} | ${logbookOver15MMOL} | ${BgLevel.SevereHyperglycemia}
|
|
48
|
-
${20} | ${logbookOver15MMOL} | ${BgLevel.SevereHyperglycemia}
|
|
49
|
-
`(`return the correct BG level for $bloodGlucoseValue`, ({ bloodGlucoseValue, bgLevel, latestLogbookFrom6Hours }) => {
|
|
50
|
-
expect(getBGLevel(bloodGlucoseValue, latestLogbookFrom6Hours)).toBe(bgLevel);
|
|
51
|
-
});
|
|
52
|
-
it.each `
|
|
53
|
-
latestLogbookFrom6Hours | severeHyperglycemia
|
|
54
|
-
${null} | ${false}
|
|
55
|
-
${logbookOver15MMOL} | ${true}
|
|
56
|
-
${logbookUnder15MMOL} | ${false}
|
|
57
|
-
${undefined} | ${false}
|
|
58
|
-
${{}} | ${false}
|
|
59
|
-
${logbookWithNullBloodGlucose} | ${false}
|
|
60
|
-
`(`tests isSevereGlycemia method `, ({ latestLogbookFrom6Hours, severeHyperglycemia }) => {
|
|
61
|
-
expect(isSevereHyperglycemia(latestLogbookFrom6Hours)).toBe(severeHyperglycemia);
|
|
62
|
-
});
|
|
63
|
-
it.each `
|
|
64
|
-
activity | within15Minutes
|
|
65
|
-
${activeActivity} | ${true}
|
|
66
|
-
${inactiveActivity} | ${false}
|
|
67
|
-
${activeActivity} | ${true}
|
|
68
|
-
${null} | ${false}
|
|
69
|
-
${undefined} | ${false}
|
|
70
|
-
`(`tests isActivityWithin15Minutes `, ({ activity, within15Minutes }) => {
|
|
71
|
-
expect(isActivityWithin15Minutes(activity)).toBe(within15Minutes);
|
|
72
|
-
});
|
|
73
|
-
it.each `
|
|
74
|
-
bgLevel | activity | attentionMessage
|
|
75
|
-
${BgLevel.UnsupportedBGLevel} | ${activeActivity} | ${CurrentBGLError()}
|
|
76
|
-
${BgLevel.UnsupportedBGLevel} | ${inactiveActivity} | ${CurrentBGLError()}
|
|
77
|
-
`(`Unsupported bg level throws error`, ({ bgLevel, activity, attentionMessage }) => {
|
|
78
|
-
expect(() => getAttentionMessage(bgLevel, activity)).toThrowError(attentionMessage);
|
|
79
|
-
});
|
|
80
|
-
it.each `
|
|
81
|
-
bgLevel | activity | attentionMessage
|
|
82
|
-
${BgLevel.BGLevelNotProvided} | ${activeActivity} | ${null}
|
|
83
|
-
${BgLevel.SevereHypoglycemia} | ${activeActivity} | ${addPostponeActivityMessageUnder5MMOL(AttentionMessage.SevereHypoglycemia())}
|
|
84
|
-
${BgLevel.Hypoglycemia} | ${activeActivity} | ${addPostponeActivityMessageUnder5MMOL(AttentionMessage.Hypoglycemia())}
|
|
85
|
-
${BgLevel.MildHypoglycemia} | ${activeActivity} | ${addPostponeActivityMessageUnder5MMOL(AttentionMessage.MildHypoglycemia())}
|
|
86
|
-
${BgLevel.NormoglycemiaUnder5MMOL} | ${activeActivity} | ${AttentionMessage.NormoglycemiaActivityUnder5MMOL()}
|
|
87
|
-
${BgLevel.Normoglycemia} | ${activeActivity} | ${null}
|
|
88
|
-
${BgLevel.MildHyperglycemia} | ${activeActivity} | ${null}
|
|
89
|
-
${BgLevel.Hyperglycemia} | ${activeActivity} | ${AttentionMessage.HyperglycemiaActivity()}
|
|
90
|
-
${BgLevel.SevereHyperglycemia} | ${activeActivity} | ${AttentionMessage.SevereHyperglycemiaActivity()}
|
|
91
|
-
`(`return the correct attention message with an active activity for $bgLevel`, ({ bgLevel, activity, attentionMessage }) => {
|
|
92
|
-
expect(getAttentionMessage(bgLevel, activity)).toBe(attentionMessage);
|
|
93
|
-
});
|
|
94
|
-
it.each `
|
|
95
|
-
bgLevel | activity | attentionMessage
|
|
96
|
-
${BgLevel.BGLevelNotProvided} | ${inactiveActivity} | ${null}
|
|
97
|
-
${BgLevel.SevereHypoglycemia} | ${inactiveActivity} | ${AttentionMessage.SevereHypoglycemia()}
|
|
98
|
-
${BgLevel.Hypoglycemia} | ${inactiveActivity} | ${AttentionMessage.Hypoglycemia()}
|
|
99
|
-
${BgLevel.MildHypoglycemia} | ${inactiveActivity} | ${AttentionMessage.MildHypoglycemia()}
|
|
100
|
-
${BgLevel.NormoglycemiaUnder5MMOL} | ${inactiveActivity} | ${null}
|
|
101
|
-
${BgLevel.Normoglycemia} | ${inactiveActivity} | ${null}
|
|
102
|
-
${BgLevel.MildHyperglycemia} | ${inactiveActivity} | ${null}
|
|
103
|
-
${BgLevel.Hyperglycemia} | ${inactiveActivity} | ${null}
|
|
104
|
-
${BgLevel.SevereHyperglycemia} | ${inactiveActivity} | ${AttentionMessage.SevereHyperglycemia()}
|
|
105
|
-
`(`return the correct attention message with an inactive activity for $bgLevel`, ({ bgLevel, activity, attentionMessage }) => {
|
|
106
|
-
expect(getAttentionMessage(bgLevel, activity)).toBe(attentionMessage);
|
|
107
|
-
});
|
|
108
|
-
it.each `
|
|
109
|
-
bgLevel | activity | carbohydrates | remeasureTime | expectedReminder
|
|
110
|
-
${BgLevel.UnsupportedBGLevel} | ${activeActivity} | ${0} | ${1} | ${CurrentBGLError()}
|
|
111
|
-
${BgLevel.UnsupportedBGLevel} | ${inactiveActivity} | ${1} | ${2} | ${CurrentBGLError()}
|
|
112
|
-
${BgLevel.UnsupportedBGLevel} | ${null} | ${0} | ${undefined} | ${CurrentBGLError()}
|
|
113
|
-
${BgLevel.UnsupportedBGLevel} | ${null} | ${1} | ${0} | ${CurrentBGLError()}
|
|
114
|
-
`(`Unsupported bg level throws error`, ({ bgLevel, activity, carbohydrates, remeasureTime, expectedReminder }) => {
|
|
115
|
-
expect(() => getReminder(bgLevel, carbohydrates, remeasureTime, activity)).toThrowError(expectedReminder);
|
|
116
|
-
});
|
|
117
|
-
it.each `
|
|
118
|
-
bgLevel | activity | carbohydrates | remeasureTime | expectedReminder
|
|
119
|
-
${BgLevel.BGLevelNotProvided} | ${activeActivity} | ${0} | ${1} | ${1}
|
|
120
|
-
${BgLevel.BGLevelNotProvided} | ${inactiveActivity} | ${0} | ${2.5} | ${2.5}
|
|
121
|
-
${BgLevel.BGLevelNotProvided} | ${null} | ${0} | ${2} | ${RecommendationReminders.ReminderOff}
|
|
122
|
-
`(`return the correct BG reminder value for when the bgl is not provided`, ({ bgLevel, activity, carbohydrates, remeasureTime, expectedReminder }) => {
|
|
123
|
-
expect(getReminder(bgLevel, carbohydrates, remeasureTime, activity)).toBe(expectedReminder);
|
|
124
|
-
});
|
|
125
|
-
it.each `
|
|
126
|
-
bgLevel | activity | carbohydrates | remeasureTime | expectedReminder
|
|
127
|
-
${BgLevel.SevereHypoglycemia} | ${activeActivity} | ${0} | ${1} | ${RecommendationReminders.Reminder15Minutes}
|
|
128
|
-
${BgLevel.SevereHypoglycemia} | ${inactiveActivity} | ${0} | ${2} | ${RecommendationReminders.Reminder15Minutes}
|
|
129
|
-
${BgLevel.SevereHypoglycemia} | ${null} | ${0} | ${undefined} | ${RecommendationReminders.Reminder15Minutes}
|
|
130
|
-
${BgLevel.SevereHypoglycemia} | ${null} | ${1} | ${0} | ${RecommendationReminders.Reminder15Minutes}
|
|
131
|
-
`(`return the correct BG reminder value for severe glycemia`, ({ bgLevel, activity, carbohydrates, remeasureTime, expectedReminder }) => {
|
|
132
|
-
expect(getReminder(bgLevel, carbohydrates, remeasureTime, activity)).toBe(expectedReminder);
|
|
133
|
-
});
|
|
134
|
-
it.each `
|
|
135
|
-
bgLevel | activity | carbohydrates | remeasureTime | expectedReminder
|
|
136
|
-
${BgLevel.Hypoglycemia} | ${activeActivity} | ${0} | ${1} | ${RecommendationReminders.Reminder15Minutes}
|
|
137
|
-
${BgLevel.Hypoglycemia} | ${inactiveActivity} | ${1} | ${2} | ${RecommendationReminders.Reminder15Minutes}
|
|
138
|
-
${BgLevel.Hypoglycemia} | ${null} | ${0} | ${undefined} | ${RecommendationReminders.Reminder15Minutes}
|
|
139
|
-
${BgLevel.Hypoglycemia} | ${null} | ${1} | ${0} | ${RecommendationReminders.Reminder15Minutes}
|
|
140
|
-
`(`return the correct BG reminder value for hypoglycemia`, ({ bgLevel, activity, carbohydrates, remeasureTime, expectedReminder }) => {
|
|
141
|
-
expect(getReminder(bgLevel, carbohydrates, remeasureTime, activity)).toBe(expectedReminder);
|
|
142
|
-
});
|
|
143
|
-
it.each `
|
|
144
|
-
bgLevel | activity | carbohydrates | remeasureTime | expectedReminder
|
|
145
|
-
${BgLevel.MildHypoglycemia} | ${activeActivity} | ${0} | ${1} | ${RecommendationReminders.Reminder15Minutes}
|
|
146
|
-
${BgLevel.MildHypoglycemia} | ${activeActivity} | ${1} | ${2} | ${RecommendationReminders.Reminder15Minutes}
|
|
147
|
-
${BgLevel.MildHypoglycemia} | ${null} | ${0} | ${3} | ${RecommendationReminders.Reminder15Minutes}
|
|
148
|
-
${BgLevel.MildHypoglycemia} | ${null} | ${1} | ${4} | ${RecommendationReminders.Reminder15Minutes}
|
|
149
|
-
`(`return the correct BG reminder value for MildHypoglycemia`, ({ bgLevel, activity, carbohydrates, remeasureTime, expectedReminder }) => {
|
|
150
|
-
expect(getReminder(bgLevel, carbohydrates, remeasureTime, activity)).toBe(expectedReminder);
|
|
151
|
-
});
|
|
152
|
-
it.each `
|
|
153
|
-
bgLevel | activity | carbohydrates | remeasureTime | expectedReminder
|
|
154
|
-
${BgLevel.NormoglycemiaUnder5MMOL} | ${activeActivity} | ${0} | ${0.5} | ${0.5}
|
|
155
|
-
${BgLevel.NormoglycemiaUnder5MMOL} | ${inactiveActivity} | ${1} | ${2} | ${2}
|
|
156
|
-
${BgLevel.NormoglycemiaUnder5MMOL} | ${null} | ${1} | ${6} | ${6}
|
|
157
|
-
${BgLevel.NormoglycemiaUnder5MMOL} | ${null} | ${0} | ${undefined} | ${RecommendationReminders.ReminderOff}
|
|
158
|
-
${BgLevel.NormoglycemiaUnder5MMOL} | ${null} | ${1} | ${undefined} | ${RecommendationReminders.HediaReminderDefault}
|
|
159
|
-
${BgLevel.NormoglycemiaUnder5MMOL} | ${null} | ${0} | ${1} | ${RecommendationReminders.ReminderOff}
|
|
160
|
-
${BgLevel.NormoglycemiaUnder5MMOL} | ${null} | ${0} | ${2} | ${RecommendationReminders.ReminderOff}
|
|
161
|
-
`(`return the correct BG reminder value for normoglycemia under 5 mmol/L`, ({ bgLevel, activity, carbohydrates, remeasureTime, expectedReminder }) => {
|
|
162
|
-
expect(getReminder(bgLevel, carbohydrates, remeasureTime, activity)).toBe(expectedReminder);
|
|
163
|
-
});
|
|
164
|
-
it.each `
|
|
165
|
-
bgLevel | activity | carbohydrates | remeasureTime | expectedReminder
|
|
166
|
-
${BgLevel.Normoglycemia} | ${activeActivity} | ${0} | ${0.5} | ${0.5}
|
|
167
|
-
${BgLevel.Normoglycemia} | ${inactiveActivity} | ${1} | ${2} | ${2}
|
|
168
|
-
${BgLevel.Normoglycemia} | ${null} | ${1} | ${6} | ${6}
|
|
169
|
-
${BgLevel.Normoglycemia} | ${null} | ${0} | ${undefined} | ${RecommendationReminders.ReminderOff}
|
|
170
|
-
${BgLevel.Normoglycemia} | ${null} | ${1} | ${undefined} | ${RecommendationReminders.HediaReminderDefault}
|
|
171
|
-
${BgLevel.Normoglycemia} | ${null} | ${0} | ${1} | ${RecommendationReminders.ReminderOff}
|
|
172
|
-
${BgLevel.Normoglycemia} | ${null} | ${0} | ${2} | ${RecommendationReminders.ReminderOff}
|
|
173
|
-
`(`return the correct BG reminder value for normoglycemia`, ({ bgLevel, activity, carbohydrates, remeasureTime, expectedReminder }) => {
|
|
174
|
-
expect(getReminder(bgLevel, carbohydrates, remeasureTime, activity)).toBe(expectedReminder);
|
|
175
|
-
});
|
|
176
|
-
it.each `
|
|
177
|
-
bgLevel | activity | carbohydrates | remeasureTime | expectedReminder
|
|
178
|
-
${BgLevel.MildHyperglycemia} | ${activeActivity} | ${0} | ${3.5} | ${3.5}
|
|
179
|
-
${BgLevel.MildHyperglycemia} | ${inactiveActivity} | ${1} | ${2} | ${2}
|
|
180
|
-
${BgLevel.MildHyperglycemia} | ${null} | ${1} | ${2.5} | ${2.5}
|
|
181
|
-
${BgLevel.MildHyperglycemia} | ${null} | ${0} | ${undefined} | ${RecommendationReminders.ReminderOff}
|
|
182
|
-
${BgLevel.MildHyperglycemia} | ${null} | ${1} | ${undefined} | ${RecommendationReminders.HediaReminderDefault}
|
|
183
|
-
${BgLevel.MildHyperglycemia} | ${null} | ${0} | ${1} | ${RecommendationReminders.ReminderOff}
|
|
184
|
-
${BgLevel.MildHyperglycemia} | ${null} | ${0} | ${2} | ${RecommendationReminders.ReminderOff}
|
|
185
|
-
`(`return the correct BG reminder value for mildglycemia`, ({ bgLevel, activity, carbohydrates, remeasureTime, expectedReminder }) => {
|
|
186
|
-
expect(getReminder(bgLevel, carbohydrates, remeasureTime, activity)).toBe(expectedReminder);
|
|
187
|
-
});
|
|
188
|
-
it.each `
|
|
189
|
-
bgLevel | activity | carbohydrates | remeasureTime | expectedReminder
|
|
190
|
-
${BgLevel.Hyperglycemia} | ${activeActivity} | ${0} | ${1} | ${RecommendationReminders.Reminder15Minutes}
|
|
191
|
-
${BgLevel.Hyperglycemia} | ${inactiveActivity} | ${1} | ${2} | ${RecommendationReminders.Reminder60Minutes}
|
|
192
|
-
${BgLevel.Hyperglycemia} | ${activeActivity} | ${0} | ${undefined} | ${RecommendationReminders.Reminder15Minutes}
|
|
193
|
-
${BgLevel.Hyperglycemia} | ${null} | ${0} | ${undefined} | ${RecommendationReminders.Reminder60Minutes}
|
|
194
|
-
${BgLevel.Hyperglycemia} | ${activeActivity} | ${1} | ${1} | ${RecommendationReminders.Reminder15Minutes}
|
|
195
|
-
${BgLevel.Hyperglycemia} | ${null} | ${1} | ${2} | ${RecommendationReminders.Reminder60Minutes}
|
|
196
|
-
`(`return the correct BG reminder value for hyperglycemia`, ({ bgLevel, activity, carbohydrates, remeasureTime, expectedReminder }) => {
|
|
197
|
-
expect(getReminder(bgLevel, carbohydrates, remeasureTime, activity)).toBe(expectedReminder);
|
|
198
|
-
});
|
|
199
|
-
it.each `
|
|
200
|
-
bgLevel | activity | carbohydrates | remeasureTime | expectedReminder
|
|
201
|
-
${BgLevel.SevereHyperglycemia} | ${activeActivity} | ${0} | ${2} | ${RecommendationReminders.Reminder15Minutes}
|
|
202
|
-
${BgLevel.SevereHyperglycemia} | ${inactiveActivity} | ${1} | ${2} | ${RecommendationReminders.Reminder60Minutes}
|
|
203
|
-
${BgLevel.SevereHyperglycemia} | ${null} | ${1} | ${undefined} | ${RecommendationReminders.Reminder60Minutes}
|
|
204
|
-
${BgLevel.SevereHyperglycemia} | ${inactiveActivity} | ${1} | ${2} | ${RecommendationReminders.Reminder60Minutes}
|
|
205
|
-
`(`return the correct BG reminder value for severeglycemia `, ({ bgLevel, activity, carbohydrates, remeasureTime, expectedReminder }) => {
|
|
206
|
-
expect(getReminder(bgLevel, carbohydrates, remeasureTime, activity)).toBe(expectedReminder);
|
|
207
|
-
});
|
|
208
|
-
it.each `
|
|
209
|
-
wasLimited | activityReduction | attentionMessage
|
|
210
|
-
${true} | ${0.25} | ${Messages.RecommendationWasLimitedActivity(0.25)}
|
|
211
|
-
${true} | ${0} | ${Messages.RecommendationWasLimited()}
|
|
212
|
-
${false} | ${0} | ${null}
|
|
213
|
-
`(`return the correct attention message for $bgLevel`, ({ wasLimited, activityReduction, attentionMessage }) => {
|
|
214
|
-
expect(getLimitationMessage(wasLimited, activityReduction)).toBe(attentionMessage);
|
|
215
|
-
});
|
|
216
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { Languages } from "@hedia/types";
|
|
3
|
-
import { changeLanguage, i18n } from "../locale/i18nUtils";
|
|
4
|
-
describe(`Translation Utils`, () => {
|
|
5
|
-
test(`Same instance`, () => {
|
|
6
|
-
expect(i18n).toBe(i18n);
|
|
7
|
-
});
|
|
8
|
-
test.each `
|
|
9
|
-
locale | text
|
|
10
|
-
${Languages.da} | ${`Dansk`}
|
|
11
|
-
${Languages.en} | ${`English`}
|
|
12
|
-
${Languages.de} | ${`Deutsch`}
|
|
13
|
-
${Languages.es} | ${`Español`}
|
|
14
|
-
${Languages.it} | ${`Italiano`}
|
|
15
|
-
${Languages.fr} | ${`Français`}
|
|
16
|
-
`(`Change to the right language; $locale`, ({ locale, text }) => {
|
|
17
|
-
expect(changeLanguage(locale).language).toBe(text);
|
|
18
|
-
});
|
|
19
|
-
test.each `
|
|
20
|
-
locale | text
|
|
21
|
-
${Languages.nl} | ${Languages.en}
|
|
22
|
-
${Languages.jp} | ${Languages.en}
|
|
23
|
-
${Languages.ro} | ${Languages.en}
|
|
24
|
-
`(`Unsupported language defaults to english; $locale`, ({ locale, text }) => {
|
|
25
|
-
expect(changeLanguage(locale).language).toBe(text);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { UserSettings } from "@hedia/types";
|
|
2
|
-
import { ACTIVITY_DURATION_MINUTES_LIMITS } from "../utils/Constants";
|
|
3
|
-
import { Utils } from "../utils/Utils";
|
|
4
|
-
const InjectionMethod = UserSettings.Enums.InjectionMethod;
|
|
5
|
-
const { PenHalf, PenWhole, Pump } = InjectionMethod;
|
|
6
|
-
describe(`Utils helper functions`, () => {
|
|
7
|
-
test.each `
|
|
8
|
-
method | expected
|
|
9
|
-
${PenWhole} | ${1}
|
|
10
|
-
${PenHalf} | ${2}
|
|
11
|
-
${Pump} | ${10}
|
|
12
|
-
`(`Get correct rounding for $method`, ({ expected, method }) => {
|
|
13
|
-
expect(Utils.getRounding(method)).toBe(expected);
|
|
14
|
-
});
|
|
15
|
-
test.each `
|
|
16
|
-
value | method | expected
|
|
17
|
-
${1.99} | ${PenWhole} | ${2}
|
|
18
|
-
${1.99} | ${PenHalf} | ${2}
|
|
19
|
-
${1.99} | ${Pump} | ${2}
|
|
20
|
-
${1.74} | ${PenWhole} | ${2}
|
|
21
|
-
${1.74} | ${PenHalf} | ${1.5}
|
|
22
|
-
${1.74} | ${Pump} | ${1.7}
|
|
23
|
-
${1.75} | ${PenWhole} | ${2}
|
|
24
|
-
${1.75} | ${PenHalf} | ${2}
|
|
25
|
-
${1.75} | ${Pump} | ${1.8}
|
|
26
|
-
${-1.45} | ${PenWhole} | ${-1}
|
|
27
|
-
${-1.45} | ${PenHalf} | ${-1.5}
|
|
28
|
-
${-1.45} | ${Pump} | ${-1.4}
|
|
29
|
-
`(`Rounding $value using $method to $expected`, ({ expected, method, value, }) => {
|
|
30
|
-
expect(Utils.roundValue(value, method)).toBe(expected);
|
|
31
|
-
});
|
|
32
|
-
const customInterval = { min: 0, max: 75.5 };
|
|
33
|
-
test.each `
|
|
34
|
-
value | interval | expected
|
|
35
|
-
${null} | ${ACTIVITY_DURATION_MINUTES_LIMITS} | ${false}
|
|
36
|
-
${undefined} | ${ACTIVITY_DURATION_MINUTES_LIMITS} | ${false}
|
|
37
|
-
${ACTIVITY_DURATION_MINUTES_LIMITS.max} | ${ACTIVITY_DURATION_MINUTES_LIMITS} | ${true}
|
|
38
|
-
${34} | ${ACTIVITY_DURATION_MINUTES_LIMITS} | ${true}
|
|
39
|
-
${ACTIVITY_DURATION_MINUTES_LIMITS.min} | ${ACTIVITY_DURATION_MINUTES_LIMITS} | ${true}
|
|
40
|
-
${0} | ${customInterval} | ${true}
|
|
41
|
-
${25.1} | ${customInterval} | ${true}
|
|
42
|
-
${75.6} | ${customInterval} | ${false}
|
|
43
|
-
${-1} | ${ACTIVITY_DURATION_MINUTES_LIMITS} | ${false}
|
|
44
|
-
${3601} | ${ACTIVITY_DURATION_MINUTES_LIMITS} | ${false}
|
|
45
|
-
`(`Check if a number is in the interval`, ({ value, interval, expected }) => {
|
|
46
|
-
expect(Utils.isInRange(value, interval)).toBe(expected);
|
|
47
|
-
});
|
|
48
|
-
test.each `
|
|
49
|
-
value | expected
|
|
50
|
-
${5.5} | ${99}
|
|
51
|
-
${11} | ${198}
|
|
52
|
-
${1.11} | ${20}
|
|
53
|
-
${12.325} | ${222}
|
|
54
|
-
`(`Convert blood glucose from mmol/L to mg/dl`, ({ value, expected }) => {
|
|
55
|
-
expect(Utils.convertBGLToMGDL(value)).toBe(expected);
|
|
56
|
-
});
|
|
57
|
-
test.each `
|
|
58
|
-
value | expected
|
|
59
|
-
${5.5} | ${57}
|
|
60
|
-
${11} | ${115}
|
|
61
|
-
${1.11} | ${12}
|
|
62
|
-
${12.325} | ${128}
|
|
63
|
-
`(`Convert from mmol/L to mg/dl`, ({ value, expected }) => {
|
|
64
|
-
expect(Utils.convertBKLToMGDL(value)).toBe(expected);
|
|
65
|
-
});
|
|
66
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|