@hedia/recommendation-screen 2.1.13 → 2.1.14
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/coverage/clover.xml +180 -175
- package/coverage/coverage-final.json +7 -7
- package/coverage/lcov-report/index.html +7 -7
- package/coverage/lcov-report/src/RecommendationScreen.tsx.html +11 -5
- package/coverage/lcov-report/src/__tests__/index.html +1 -1
- package/coverage/lcov-report/src/__tests__/utils.tsx.html +3 -3
- package/coverage/lcov-report/src/components/Header.tsx.html +3 -3
- package/coverage/lcov-report/src/components/InfoBars.tsx.html +3 -3
- package/coverage/lcov-report/src/components/InvisibleNumberInput.tsx.html +1 -1
- package/coverage/lcov-report/src/components/LimitationMessage.tsx.html +3 -3
- package/coverage/lcov-report/src/components/LineSeparator.tsx.html +1 -1
- package/coverage/lcov-report/src/components/RecentInsulin.tsx.html +4 -4
- package/coverage/lcov-report/src/components/RecommendationModal.tsx.html +11 -5
- package/coverage/lcov-report/src/components/RecommendedCarbs.tsx.html +12 -6
- package/coverage/lcov-report/src/components/RecommendedInsulin.tsx.html +11 -5
- package/coverage/lcov-report/src/components/Remeasure.tsx.html +3 -3
- package/coverage/lcov-report/src/components/TransferToLogbook.tsx.html +3 -3
- package/coverage/lcov-report/src/components/TwoOptionModal.tsx.html +11 -5
- package/coverage/lcov-report/src/components/activity/Activity.tsx.html +13 -4
- package/coverage/lcov-report/src/components/activity/ActivityIcon.tsx.html +1 -1
- package/coverage/lcov-report/src/components/activity/ActivityIntensity.tsx.html +1 -1
- package/coverage/lcov-report/src/components/activity/index.html +1 -1
- package/coverage/lcov-report/src/components/index.html +11 -11
- package/coverage/lcov-report/src/components/mood/Emotion.tsx.html +1 -1
- package/coverage/lcov-report/src/components/mood/MoodIcon.tsx.html +1 -1
- package/coverage/lcov-report/src/components/mood/index.html +1 -1
- package/coverage/lcov-report/src/index.html +5 -5
- package/coverage/lcov-report/src/locale/i18nUtils.ts.html +1 -1
- package/coverage/lcov-report/src/locale/index.html +1 -1
- package/coverage/lcov-report/src/utils/AttentionMessages.tsx.html +1 -1
- package/coverage/lcov-report/src/utils/Constants.ts.html +1 -1
- package/coverage/lcov-report/src/utils/RecommendationError.tsx.html +1 -1
- package/coverage/lcov-report/src/utils/RecommendationUtils.ts.html +1 -1
- package/coverage/lcov-report/src/utils/Translations.ts.html +1 -1
- package/coverage/lcov-report/src/utils/Utils.ts.html +1 -1
- package/coverage/lcov-report/src/utils/Validations.ts.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/coverage/lcov.info +330 -325
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +1 -1
- package/src/RecommendationScreen.js +2 -1
- package/src/__tests__/RecommendationScreen.test.js +2 -1
- package/src/__tests__/components/Activity.test.js +2 -2
- package/src/__tests__/components/Header.test.js +2 -2
- package/src/__tests__/components/LimitationMessage.test.js +2 -2
- package/src/__tests__/components/RecommendationModal.test.js +2 -1
- package/src/__tests__/components/RecommendedCarbs.test.js +2 -1
- package/src/__tests__/components/RecommendedInsulin.test.js +2 -1
- package/src/__tests__/components/Remeasure.test.js +2 -1
- package/src/__tests__/components/TransferToLogbook.test.js +2 -2
- package/src/__tests__/components/TwoOptionModal.test.js +2 -1
- package/src/__tests__/utils.d.ts +2 -2
- package/src/components/Header.js +2 -2
- package/src/components/InfoBars.d.ts +3 -3
- package/src/components/LimitationMessage.js +2 -2
- package/src/components/RecentInsulin.js +3 -3
- package/src/components/RecommendationModal.js +2 -1
- package/src/components/RecommendedCarbs.d.ts +2 -2
- package/src/components/RecommendedCarbs.js +2 -1
- package/src/components/RecommendedInsulin.js +2 -1
- package/src/components/Remeasure.js +2 -2
- package/src/components/TransferToLogbook.js +2 -2
- package/src/components/TwoOptionModal.js +2 -1
- package/src/components/activity/Activity.js +2 -2
- package/src/types/enum.d.ts +67 -61
- package/src/types/enum.js +84 -78
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import RecommendationScreen from "./src/RecommendationScreen";
|
|
2
|
-
import { RecommendationErrorEnum } from "./src/types/enum";
|
|
3
2
|
import * as Errors from "./src/utils/RecommendationError";
|
|
4
3
|
export default RecommendationScreen;
|
|
5
|
-
export { Errors
|
|
4
|
+
export { Errors };
|
|
5
|
+
export * from "./src/types/enum";
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import RecommendationScreen from "./src/RecommendationScreen";
|
|
2
|
-
import { RecommendationErrorEnum } from "./src/types/enum";
|
|
3
2
|
import * as Errors from "./src/utils/RecommendationError";
|
|
4
3
|
export default RecommendationScreen;
|
|
5
|
-
export { Errors
|
|
4
|
+
export { Errors };
|
|
5
|
+
export * from "./src/types/enum";
|
package/package.json
CHANGED
|
@@ -18,11 +18,12 @@ import LimitationMessage from "./components/LimitationMessage";
|
|
|
18
18
|
import RecommendationModal from "./components/RecommendationModal";
|
|
19
19
|
import TwoOptionModal, { modalStyle } from "./components/TwoOptionModal";
|
|
20
20
|
import { changeLanguage, i18n } from "./locale/i18nUtils";
|
|
21
|
-
import {
|
|
21
|
+
import { Testing } from "./types/enum";
|
|
22
22
|
import { Messages } from "./utils/AttentionMessages";
|
|
23
23
|
import { getAttentionMessage, getBGLevel, getLimitationMessage, getReminder } from "./utils/RecommendationUtils";
|
|
24
24
|
import { Utils } from "./utils/Utils";
|
|
25
25
|
import { validateParams } from "./utils/Validations";
|
|
26
|
+
const { InfoBarTestIds, RecommendationScreenTestIds } = Testing.Id;
|
|
26
27
|
// Ignoring long timer warnings
|
|
27
28
|
// https://github.com/facebook/react-native/issues/12981#issuecomment-652745831
|
|
28
29
|
YellowBox.ignoreWarnings([`Setting a timer`]);
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
import { cleanup, fireEvent, render } from "react-native-testing-library";
|
|
4
4
|
import { i18n } from "../locale/i18nUtils";
|
|
5
5
|
import RecommendationScreen from "../RecommendationScreen";
|
|
6
|
-
import {
|
|
6
|
+
import { RecommendationReminders, Testing } from "../types/enum";
|
|
7
7
|
import { Messages } from "../utils/AttentionMessages";
|
|
8
8
|
import { LanguageError } from "../utils/RecommendationError";
|
|
9
9
|
import { ActivityIntensityTranslations } from "../utils/Translations";
|
|
@@ -14,6 +14,7 @@ const ActivityEnum = Activity.Enums.ActivityEnum;
|
|
|
14
14
|
const InjectionMethod = UserSettings.Enums.InjectionMethod;
|
|
15
15
|
const MoodEnum = Logbook.Enums.MoodEnum;
|
|
16
16
|
const { light, moderate, hard } = ActivityIntensity;
|
|
17
|
+
const { HeaderTestIds, InfoBarTestIds, LimitationMessageTestIds, RecentInsulinTestIds, RecommendationModalTestIds, RecommendedCarbsTestIds, RecommendedInsulinTestIds, RemeasureTestIds, TransferToLogbookTestIds, TwoOptionModalTestIds, } = Testing.Id;
|
|
17
18
|
describe(`RecommendationScreen`, () => {
|
|
18
19
|
jest.useFakeTimers();
|
|
19
20
|
beforeEach(() => {
|
|
@@ -4,7 +4,7 @@ import React from "react";
|
|
|
4
4
|
import { cleanup, render } from "react-native-testing-library";
|
|
5
5
|
import { default as ActivityComponent } from "../../components/activity/Activity";
|
|
6
6
|
import { i18n } from "../../locale/i18nUtils";
|
|
7
|
-
import {
|
|
7
|
+
import { Testing } from "../../types/enum";
|
|
8
8
|
import { ActivityIntensityTranslations } from "../../utils/Translations";
|
|
9
9
|
import { expectTextExists, generateActivityProps, getRecommendationProps, i18nProvided, queryTextFromComponent, } from "../utils";
|
|
10
10
|
const ActivityIntensity = Activity.Enums.ActivityIntensity;
|
|
@@ -47,7 +47,7 @@ describe(`Activity - Component`, () => {
|
|
|
47
47
|
const activity = generateActivityProps();
|
|
48
48
|
const reduction = null;
|
|
49
49
|
const wrapper = render(i18nProvided(<ActivityComponent activity={activity} activityType={activityDisplayProps?.activityType ?? null} activityReduction={reduction} activityTitle={activityDisplayProps?.activityTitle ?? null}/>));
|
|
50
|
-
const text = queryTextFromComponent(wrapper, ActivityTestIds.ActivityReduction);
|
|
50
|
+
const text = queryTextFromComponent(wrapper, Testing.Id.ActivityTestIds.ActivityReduction);
|
|
51
51
|
expect(text).toBe(`0%`);
|
|
52
52
|
});
|
|
53
53
|
test(`Can render activity title`, () => {
|
|
@@ -5,14 +5,14 @@ import { I18nProvider } from "@lingui/react";
|
|
|
5
5
|
import Header from "../../components/Header";
|
|
6
6
|
import { Languages } from "@hedia/types";
|
|
7
7
|
import { i18n } from "../../locale/i18nUtils";
|
|
8
|
-
import {
|
|
8
|
+
import { Testing } from "../../types/enum";
|
|
9
9
|
describe(`Header Component`, () => {
|
|
10
10
|
afterEach(cleanup);
|
|
11
11
|
test(`Exit button calls exitCallback`, () => {
|
|
12
12
|
const props = getRecommendationProps();
|
|
13
13
|
const { getByTestId } = render(<Header exitCallback={props.exitCallback}/>);
|
|
14
14
|
expect(props.exitCallback).not.toBeCalled();
|
|
15
|
-
fireEvent.press(getByTestId(HeaderTestIds.ExitCalculation));
|
|
15
|
+
fireEvent.press(getByTestId(Testing.Id.HeaderTestIds.ExitCalculation));
|
|
16
16
|
expect(props.exitCallback).toBeCalled();
|
|
17
17
|
});
|
|
18
18
|
test.each `
|
|
@@ -4,7 +4,7 @@ import React from "react";
|
|
|
4
4
|
import { cleanup, fireEvent, render } from "react-native-testing-library";
|
|
5
5
|
import LimitationMessage from "../../components/LimitationMessage";
|
|
6
6
|
import { i18n } from "../../locale/i18nUtils";
|
|
7
|
-
import {
|
|
7
|
+
import { Testing } from "../../types/enum";
|
|
8
8
|
import { Messages } from "../../utils/AttentionMessages";
|
|
9
9
|
import { expectTextExists } from "../utils";
|
|
10
10
|
const SAFETY_INSULIN_LIMIT = BolusCalculator.Constants.SAFETY_INSULIN_LIMIT;
|
|
@@ -20,7 +20,7 @@ describe(`Info Bars Component`, () => {
|
|
|
20
20
|
onPressNextButton,
|
|
21
21
|
};
|
|
22
22
|
const limitationMessage = render(<LimitationMessage {...props}/>);
|
|
23
|
-
const nextButton = limitationMessage.getByTestId(LimitationMessageTestIds.OkButton);
|
|
23
|
+
const nextButton = limitationMessage.getByTestId(Testing.Id.LimitationMessageTestIds.OkButton);
|
|
24
24
|
fireEvent(nextButton, `onPress`);
|
|
25
25
|
expect(onPressNextButton).toBeCalled();
|
|
26
26
|
});
|
|
@@ -4,9 +4,10 @@ import React from "react";
|
|
|
4
4
|
import { cleanup, fireEvent, render } from "react-native-testing-library";
|
|
5
5
|
import RecommendationModal from "../../components/RecommendationModal";
|
|
6
6
|
import { i18n } from "../../locale/i18nUtils";
|
|
7
|
-
import {
|
|
7
|
+
import { Testing } from "../../types/enum";
|
|
8
8
|
import { Messages } from "../../utils/AttentionMessages";
|
|
9
9
|
import { expectTextExists, expectTextNotExists } from "../utils";
|
|
10
|
+
const { LimitationMessageTestIds, RecommendationModalTestIds } = Testing.Id;
|
|
10
11
|
describe(`RecommendationModal Component`, () => {
|
|
11
12
|
afterEach(cleanup);
|
|
12
13
|
beforeEach(() => {
|
|
@@ -2,8 +2,9 @@ import React from "react";
|
|
|
2
2
|
import { cleanup, fireEvent, render } from "react-native-testing-library";
|
|
3
3
|
import InvisibleNumberInput from "../../components/InvisibleNumberInput";
|
|
4
4
|
import RecommendedCarbs from "../../components/RecommendedCarbs";
|
|
5
|
-
import {
|
|
5
|
+
import { Testing } from "../../types/enum";
|
|
6
6
|
import { expectTextExists, expectTextNotExists } from "../utils";
|
|
7
|
+
const { RecommendedCarbsTestIds } = Testing.Id;
|
|
7
8
|
describe(`Calculation Component`, () => {
|
|
8
9
|
afterEach(cleanup);
|
|
9
10
|
test(`calculate total carbs`, () => {
|
|
@@ -3,8 +3,9 @@ import React from "react";
|
|
|
3
3
|
import { Platform } from "react-native";
|
|
4
4
|
import { cleanup, fireEvent, render } from "react-native-testing-library";
|
|
5
5
|
import RecommendedInsulin from "../../components/RecommendedInsulin";
|
|
6
|
-
import {
|
|
6
|
+
import { Testing } from "../../types/enum";
|
|
7
7
|
import { expectTextExists, expectTextNotExists } from "../utils";
|
|
8
|
+
const { RecommendedInsulinTestIds } = Testing.Id;
|
|
8
9
|
const SAFETY_INSULIN_LIMIT = BolusCalculator.Constants.SAFETY_INSULIN_LIMIT;
|
|
9
10
|
const InjectionMethod = UserSettings.Enums.InjectionMethod;
|
|
10
11
|
const { PenHalf, PenWhole, Pump } = InjectionMethod;
|
|
@@ -2,8 +2,9 @@ import React from "react";
|
|
|
2
2
|
import { Platform } from "react-native";
|
|
3
3
|
import { cleanup, fireEvent, render } from "react-native-testing-library";
|
|
4
4
|
import Remeasure from "../../components/Remeasure";
|
|
5
|
-
import {
|
|
5
|
+
import { Testing } from "../../types/enum";
|
|
6
6
|
import { expectTextExists, expectTextNotExists } from "../utils";
|
|
7
|
+
const { RemeasureTestIds } = Testing.Id;
|
|
7
8
|
describe(`Remeasure Component`, () => {
|
|
8
9
|
afterEach(cleanup);
|
|
9
10
|
test.each `
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { fireEvent, render } from "react-native-testing-library";
|
|
3
3
|
import TransferToLogbook from "../../components/TransferToLogbook";
|
|
4
|
-
import {
|
|
4
|
+
import { Testing } from "../../types/enum";
|
|
5
5
|
import { expectTextExists, expectTextNotExists } from "../utils";
|
|
6
6
|
describe(`TransferToLogbook - Component`, () => {
|
|
7
7
|
test(`Is null when visible not visible`, () => {
|
|
@@ -20,7 +20,7 @@ describe(`TransferToLogbook - Component`, () => {
|
|
|
20
20
|
const transferMock = jest.fn();
|
|
21
21
|
const wrapper = render(<TransferToLogbook visible={true} transfer={transferMock}/>);
|
|
22
22
|
expectTextExists(wrapper, `Transfer to logbook`);
|
|
23
|
-
const button = wrapper.getByTestId(TransferToLogbookTestIds.TransferButton);
|
|
23
|
+
const button = wrapper.getByTestId(Testing.Id.TransferToLogbookTestIds.TransferButton);
|
|
24
24
|
expect(transferMock).not.toBeCalled();
|
|
25
25
|
fireEvent(button, `onPress`);
|
|
26
26
|
expectTextNotExists(wrapper, `Transfer to logbook`);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { cleanup, fireEvent, render } from "react-native-testing-library";
|
|
3
3
|
import TwoOptionModal from "../../components/TwoOptionModal";
|
|
4
|
-
import {
|
|
4
|
+
import { Testing } from "../../types/enum";
|
|
5
5
|
import { expectTextExists } from "../utils";
|
|
6
|
+
const { TwoOptionModalTestIds } = Testing.Id;
|
|
6
7
|
describe(`TwoOptionModal Component`, () => {
|
|
7
8
|
afterEach(cleanup);
|
|
8
9
|
test(`Can can show text `, () => {
|
package/src/__tests__/utils.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { RenderAPI } from "react-native-testing-library";
|
|
3
3
|
import { ReactTestInstance } from "react-test-renderer";
|
|
4
4
|
import { IRecommendationProps } from "../RecommendationScreen";
|
|
5
|
-
import {
|
|
5
|
+
import { Testing } from "../types/enum";
|
|
6
6
|
import { IActivityParams, IRecommendationParams, logbookEntry } from "../types/types";
|
|
7
7
|
export declare function getRecommendationProps(partials?: Partial<IRecommendationProps>): IRecommendationProps;
|
|
8
8
|
export declare function generateDefaultCalculatorParams(): IRecommendationParams;
|
|
@@ -10,7 +10,7 @@ export declare function generateActivityProps(): IActivityParams;
|
|
|
10
10
|
export declare function generateDefaultActivitySettings(): IActivityParams["activitySettings"];
|
|
11
11
|
export declare function generateDefaultLogbook(): logbookEntry;
|
|
12
12
|
export declare function expectTextExists(component: RenderAPI, text: string | RegExp): void;
|
|
13
|
-
export declare function queryTextFromComponent(wrapper: RenderAPI, testID: TestIdEnum): string;
|
|
13
|
+
export declare function queryTextFromComponent(wrapper: RenderAPI, testID: Testing.Types.TestIdEnum): string;
|
|
14
14
|
export declare function expectTextNotExists(component: RenderAPI, text: string | RegExp): void;
|
|
15
15
|
export declare function i18nProvided(element: JSX.Element): JSX.Element;
|
|
16
16
|
export declare function getIcon(wrapper: RenderAPI, name: string, active: boolean): ReactTestInstance | null;
|
package/src/components/Header.js
CHANGED
|
@@ -2,7 +2,7 @@ import { t } from "@lingui/macro";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Dimensions, SafeAreaView, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
4
4
|
import { i18n } from "../locale/i18nUtils";
|
|
5
|
-
import {
|
|
5
|
+
import { Testing } from "../types/enum";
|
|
6
6
|
import { BACKGROUND_COLOUR_PURPLE, BORDER_COLOUR_GREY } from "../utils/Constants";
|
|
7
7
|
import Icon from "./Icon";
|
|
8
8
|
export default class Header extends React.Component {
|
|
@@ -13,7 +13,7 @@ export default class Header extends React.Component {
|
|
|
13
13
|
<View style={headerStyles.margin}>
|
|
14
14
|
<View style={headerStyles.exitButtonContainer}>
|
|
15
15
|
<View style={headerStyles.exitButton}>
|
|
16
|
-
<TouchableOpacity testID={HeaderTestIds.ExitCalculation} accessibilityLabel="exitButton" style={headerStyles.exitButton} onPress={this.props.exitCallback}>
|
|
16
|
+
<TouchableOpacity testID={Testing.Id.HeaderTestIds.ExitCalculation} accessibilityLabel="exitButton" style={headerStyles.exitButton} onPress={this.props.exitCallback}>
|
|
17
17
|
<Icon iconIdentifier={`Ionicons/ios-close-circle-outline`} style={headerStyles.iconStyle}/>
|
|
18
18
|
</TouchableOpacity>
|
|
19
19
|
<View style={headerStyles.headerFiller}/>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { BloodGlucoseUnit, BloodKetonesUnit } from "@hedia/types";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { Testing } from "../types/enum";
|
|
4
4
|
export interface IProps {
|
|
5
5
|
label: string;
|
|
6
6
|
value: string | null;
|
|
7
7
|
unit: string | BloodGlucoseUnit | BloodKetonesUnit | null;
|
|
8
8
|
showNullAsDash: boolean;
|
|
9
9
|
testID?: {
|
|
10
|
-
valueID: InfoBarTestIds.Value;
|
|
11
|
-
unitID: InfoBarTestIds.Unit;
|
|
10
|
+
valueID: Testing.Id.InfoBarTestIds.Value;
|
|
11
|
+
unitID: Testing.Id.InfoBarTestIds.Unit;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
export default class InfoBars extends React.Component<IProps> {
|
|
@@ -2,7 +2,7 @@ import { t } from "@lingui/macro";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Text, TouchableOpacity, View } from "react-native";
|
|
4
4
|
import { i18n } from "../locale/i18nUtils";
|
|
5
|
-
import {
|
|
5
|
+
import { Testing } from "../types/enum";
|
|
6
6
|
import { stylesModal } from "./RecommendationModal";
|
|
7
7
|
export default class LimitationMessage extends React.Component {
|
|
8
8
|
constructor() {
|
|
@@ -17,7 +17,7 @@ export default class LimitationMessage extends React.Component {
|
|
|
17
17
|
<Text style={stylesModal.textMessage}>{limitationMessage}</Text>
|
|
18
18
|
</View>
|
|
19
19
|
<View style={stylesModal.containerAcceptButton}>
|
|
20
|
-
<TouchableOpacity testID={LimitationMessageTestIds.OkButton} accessibilityLabel="nextButtonModal" style={stylesModal.okButton} onPress={this.props.onPressNextButton}>
|
|
20
|
+
<TouchableOpacity testID={Testing.Id.LimitationMessageTestIds.OkButton} accessibilityLabel="nextButtonModal" style={stylesModal.okButton} onPress={this.props.onPressNextButton}>
|
|
21
21
|
<Text style={stylesModal.buttonText}>{i18n._(t `OK`)}</Text>
|
|
22
22
|
</TouchableOpacity>
|
|
23
23
|
</View>
|
|
@@ -2,7 +2,7 @@ import { t } from "@lingui/macro";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Dimensions, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
4
4
|
import { i18n } from "../locale/i18nUtils";
|
|
5
|
-
import {
|
|
5
|
+
import { Testing } from "../types/enum";
|
|
6
6
|
import { infoStyles } from "./InfoBars";
|
|
7
7
|
export default class RecentInsulin extends React.Component {
|
|
8
8
|
constructor() {
|
|
@@ -19,10 +19,10 @@ export default class RecentInsulin extends React.Component {
|
|
|
19
19
|
</View>
|
|
20
20
|
<View style={recentInsulinStyles.buttonContainer}>
|
|
21
21
|
<View style={recentInsulinStyles.filler}/>
|
|
22
|
-
<TouchableOpacity testID={RecentInsulinTestIds.Yes} onPress={this.props.onRecentInsulinYes} style={[recentInsulinStyles.yesNoContainer, { marginRight: `2%` }]}>
|
|
22
|
+
<TouchableOpacity testID={Testing.Id.RecentInsulinTestIds.Yes} onPress={this.props.onRecentInsulinYes} style={[recentInsulinStyles.yesNoContainer, { marginRight: `2%` }]}>
|
|
23
23
|
<Text style={recentInsulinStyles.yesNoText}>{i18n._(t `Yes`)}</Text>
|
|
24
24
|
</TouchableOpacity>
|
|
25
|
-
<TouchableOpacity testID={RecentInsulinTestIds.No} onPress={this.props.onRecentInsulinNo} style={[recentInsulinStyles.yesNoContainer, { marginLeft: `2%` }]}>
|
|
25
|
+
<TouchableOpacity testID={Testing.Id.RecentInsulinTestIds.No} onPress={this.props.onRecentInsulinNo} style={[recentInsulinStyles.yesNoContainer, { marginLeft: `2%` }]}>
|
|
26
26
|
<Text style={recentInsulinStyles.yesNoText}>{i18n._(t `No`)}</Text>
|
|
27
27
|
</TouchableOpacity>
|
|
28
28
|
<View style={recentInsulinStyles.filler}/>
|
|
@@ -3,9 +3,10 @@ import * as React from "react";
|
|
|
3
3
|
import { Dimensions, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
4
4
|
import ReactNativeModal from "react-native-modal";
|
|
5
5
|
import { i18n } from "../locale/i18nUtils";
|
|
6
|
-
import {
|
|
6
|
+
import { Testing } from "../types/enum";
|
|
7
7
|
import { BORDER_COLOUR_TEAL } from "../utils/Constants";
|
|
8
8
|
import LimitationMessage from "./LimitationMessage";
|
|
9
|
+
const { RecommendationModalTestIds } = Testing.Id;
|
|
9
10
|
export default class RecommendationModal extends React.Component {
|
|
10
11
|
constructor(props) {
|
|
11
12
|
super(props);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Testing } from "../types/enum";
|
|
3
3
|
interface ICalculationRow {
|
|
4
4
|
label: string;
|
|
5
5
|
value: string;
|
|
@@ -21,7 +21,7 @@ export default class RecommendedCarbs extends React.Component<IProps, IState> {
|
|
|
21
21
|
handlePartialInput: (partialInput: string) => void;
|
|
22
22
|
handleChangedCarbs: (carbs: number) => void;
|
|
23
23
|
renderRecommendedCarbs: () => JSX.Element;
|
|
24
|
-
renderRow: (row: ICalculationRow, testID: RecommendedCarbsTestIds) => JSX.Element;
|
|
24
|
+
renderRow: (row: ICalculationRow, testID: Testing.Id.RecommendedCarbsTestIds) => JSX.Element;
|
|
25
25
|
render(): JSX.Element;
|
|
26
26
|
}
|
|
27
27
|
export {};
|
|
@@ -2,13 +2,14 @@ import { t } from "@lingui/macro";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Alert, Dimensions, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
4
4
|
import { i18n } from "../locale/i18nUtils";
|
|
5
|
-
import {
|
|
5
|
+
import { Testing } from "../types/enum";
|
|
6
6
|
import { BORDER_COLOUR_GREY, BORDER_COLOUR_TEAL } from "../utils/Constants";
|
|
7
7
|
import { CarbohydrateLimitError } from "../utils/RecommendationError";
|
|
8
8
|
import Icon from "./Icon";
|
|
9
9
|
import { infoStyles } from "./InfoBars";
|
|
10
10
|
import InvisibleNumberInput from "./InvisibleNumberInput";
|
|
11
11
|
import LineSeparator from "./LineSeparator";
|
|
12
|
+
const { RecommendedCarbsTestIds } = Testing.Id;
|
|
12
13
|
export default class RecommendedCarbs extends React.Component {
|
|
13
14
|
constructor() {
|
|
14
15
|
super(...arguments);
|
|
@@ -4,12 +4,13 @@ import React from "react";
|
|
|
4
4
|
import { Alert, Dimensions, Platform, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
5
5
|
import LinearGradient from "react-native-linear-gradient";
|
|
6
6
|
import { i18n } from "../locale/i18nUtils";
|
|
7
|
-
import {
|
|
7
|
+
import { Testing } from "../types/enum";
|
|
8
8
|
import { Messages } from "../utils/AttentionMessages";
|
|
9
9
|
import { Utils } from "../utils/Utils";
|
|
10
10
|
import Icon from "./Icon";
|
|
11
11
|
import { infoStyles } from "./InfoBars";
|
|
12
12
|
import InvisibleNumberInput from "./InvisibleNumberInput";
|
|
13
|
+
const { RecommendedInsulinTestIds } = Testing.Id;
|
|
13
14
|
const SAFETY_INSULIN_LIMIT = BolusCalculator.Constants.SAFETY_INSULIN_LIMIT;
|
|
14
15
|
export default class RecommendedInsulin extends React.Component {
|
|
15
16
|
constructor(props) {
|
|
@@ -3,7 +3,7 @@ import Slider from "@react-native-community/slider";
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { Dimensions, Platform, StyleSheet, Text, View } from "react-native";
|
|
5
5
|
import { i18n } from "../locale/i18nUtils";
|
|
6
|
-
import {
|
|
6
|
+
import { Testing } from "../types/enum";
|
|
7
7
|
import { BORDER_COLOUR_GREY, BORDER_COLOUR_TEAL } from "../utils/Constants";
|
|
8
8
|
import { infoStyles } from "./InfoBars";
|
|
9
9
|
export default class Remeasure extends React.Component {
|
|
@@ -45,7 +45,7 @@ export default class Remeasure extends React.Component {
|
|
|
45
45
|
if (slider !== null) {
|
|
46
46
|
this.slider = slider;
|
|
47
47
|
}
|
|
48
|
-
}} testID={RemeasureTestIds.RemeasureSlider} accessibilityLabel="remeasureSlider" maximumTrackTintColor={BORDER_COLOUR_GREY} minimumTrackTintColor={BORDER_COLOUR_TEAL} thumbTintColor={BORDER_COLOUR_TEAL} maximumValue={6} minimumValue={0} step={0.5} style={[remeasureStyles.sliderStyle, { marginHorizontal }]} onValueChange={this.handleSliderChange}/>
|
|
48
|
+
}} testID={Testing.Id.RemeasureTestIds.RemeasureSlider} accessibilityLabel="remeasureSlider" maximumTrackTintColor={BORDER_COLOUR_GREY} minimumTrackTintColor={BORDER_COLOUR_TEAL} thumbTintColor={BORDER_COLOUR_TEAL} maximumValue={6} minimumValue={0} step={0.5} style={[remeasureStyles.sliderStyle, { marginHorizontal }]} onValueChange={this.handleSliderChange}/>
|
|
49
49
|
</View>);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { Dimensions, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
3
3
|
import { t } from "@lingui/macro";
|
|
4
4
|
import { i18n } from "../locale/i18nUtils";
|
|
5
|
-
import {
|
|
5
|
+
import { Testing } from "../types/enum";
|
|
6
6
|
import Icon from "./Icon";
|
|
7
7
|
export default class TransferToLogbook extends React.Component {
|
|
8
8
|
constructor() {
|
|
@@ -21,7 +21,7 @@ export default class TransferToLogbook extends React.Component {
|
|
|
21
21
|
if (!this.props.visible) {
|
|
22
22
|
return <View style={addToLogbookStyles.marginContainer}/>;
|
|
23
23
|
}
|
|
24
|
-
return (<TouchableOpacity testID={TransferToLogbookTestIds.TransferButton} onPress={this.handlePress} disabled={this.state.pressed} style={addToLogbookStyles.container} accessibilityLabel="transferToLogbook">
|
|
24
|
+
return (<TouchableOpacity testID={Testing.Id.TransferToLogbookTestIds.TransferButton} onPress={this.handlePress} disabled={this.state.pressed} style={addToLogbookStyles.container} accessibilityLabel="transferToLogbook">
|
|
25
25
|
{!this.state.pressed ? (<View style={addToLogbookStyles.textContainer}>
|
|
26
26
|
<Text style={addToLogbookStyles.transferText}>{i18n._(t `Transfer to logbook`)}</Text>
|
|
27
27
|
</View>) : (<View style={addToLogbookStyles.textContainerActive}>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Dimensions, StatusBar, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
3
|
-
import {
|
|
3
|
+
import { Testing } from "../types/enum";
|
|
4
4
|
import { BACKGROUND_COLOUR_PURPLE, BORDER_COLOUR_GREY, BORDER_COLOUR_TEAL } from "../utils/Constants";
|
|
5
5
|
import Icon from "./Icon";
|
|
6
6
|
import { stylesModal } from "./RecommendationModal";
|
|
7
|
+
const { TwoOptionModalTestIds } = Testing.Id;
|
|
7
8
|
export default class TwoOptionModal extends React.Component {
|
|
8
9
|
constructor(props) {
|
|
9
10
|
super(props);
|
|
@@ -2,7 +2,7 @@ import { t } from "@lingui/macro";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Dimensions, StyleSheet, Text, View } from "react-native";
|
|
4
4
|
import { i18n } from "../../locale/i18nUtils";
|
|
5
|
-
import {
|
|
5
|
+
import { Testing } from "../../types/enum";
|
|
6
6
|
import { infoStyles } from "../InfoBars";
|
|
7
7
|
import ActivityIcon from "./ActivityIcon";
|
|
8
8
|
import ActivityIntensity from "./ActivityIntensity";
|
|
@@ -34,7 +34,7 @@ export default class Activity extends React.Component {
|
|
|
34
34
|
</Text>
|
|
35
35
|
</View>
|
|
36
36
|
<View style={[infoStyles.borderContainer, activityStyles.verticalMargin]}>
|
|
37
|
-
<Text style={activityStyles.reductionPercentage} testID={ActivityTestIds.ActivityReduction}>
|
|
37
|
+
<Text style={activityStyles.reductionPercentage} testID={Testing.Id.ActivityTestIds.ActivityReduction}>
|
|
38
38
|
{reductionPercentage}%
|
|
39
39
|
</Text>
|
|
40
40
|
</View>
|
package/src/types/enum.d.ts
CHANGED
|
@@ -1,67 +1,73 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
1
|
+
export declare namespace Testing {
|
|
2
|
+
namespace Id {
|
|
3
|
+
enum RecommendationScreenTestIds {
|
|
4
|
+
RecommendationScrollView = "recommendation-screen-scroll-view"
|
|
5
|
+
}
|
|
6
|
+
enum ActivityTestIds {
|
|
7
|
+
ActivityReduction = "activity-reduction-percentage"
|
|
8
|
+
}
|
|
9
|
+
enum HeaderTestIds {
|
|
10
|
+
ExitCalculation = "exit-calculation-button"
|
|
11
|
+
}
|
|
12
|
+
enum LimitationMessageTestIds {
|
|
13
|
+
OkButton = "limitation-message-ok-button"
|
|
14
|
+
}
|
|
15
|
+
enum RecentInsulinTestIds {
|
|
16
|
+
No = "recent-insulin-no",
|
|
17
|
+
Yes = "recent-insulin-yes"
|
|
18
|
+
}
|
|
19
|
+
enum RecommendedCarbsTestIds {
|
|
20
|
+
RecommendedCarbs = "recommended-carbs",
|
|
21
|
+
EditRecommendedCarbs = "edit-recommended-carbs",
|
|
22
|
+
InvisibleCarbInput = "invisible-recommended-carbs-input",
|
|
23
|
+
EnteredCarbs = "entered-carbs",
|
|
24
|
+
RemoveRecommendation = "remove-carb-recommendation",
|
|
25
|
+
TotalCarbs = "total-carbs"
|
|
26
|
+
}
|
|
27
|
+
enum RecommendedInsulinTestIds {
|
|
28
|
+
EditRecommendedInsulin = "edit-recommended-insulin",
|
|
29
|
+
InvisibleInsulinInput = "invisible-recommended-insulin-input",
|
|
30
|
+
ShownInsulinText = "shown-insulin-text"
|
|
31
|
+
}
|
|
32
|
+
enum RecommendationModalTestIds {
|
|
33
|
+
DeclineCarbs = "recommendation-modal-decline-carbs",
|
|
34
|
+
AcceptCarbs = "recommendation-modal-accept-carbs",
|
|
35
|
+
OkButton = "recommendation-modal-ok-button",
|
|
36
|
+
SuggestedCarbs = "recommendation-modal-suggested-carbs"
|
|
37
|
+
}
|
|
38
|
+
enum RemeasureTestIds {
|
|
39
|
+
RemeasureSlider = "remeasure-slider"
|
|
40
|
+
}
|
|
41
|
+
enum TransferToLogbookTestIds {
|
|
42
|
+
TransferButton = "transfer-to-logbook-button"
|
|
43
|
+
}
|
|
44
|
+
enum TwoOptionModalTestIds {
|
|
45
|
+
ExitButton = "exit-two-option-modal",
|
|
46
|
+
FirstOption = "first-option-button",
|
|
47
|
+
SecondOption = "second-option-button"
|
|
48
|
+
}
|
|
49
|
+
namespace InfoBarTestIds {
|
|
50
|
+
enum Value {
|
|
51
|
+
BloodGlucose = "BloodGlucoseValue",
|
|
52
|
+
BloodKetone = "BloodKetoneValue",
|
|
53
|
+
ActiveInsulin = "ActiveInsulinValue"
|
|
54
|
+
}
|
|
55
|
+
enum Label {
|
|
56
|
+
BloodKetone = "BloodKetoneLabel",
|
|
57
|
+
BloodGlucose = "BloodGlucoseLabel",
|
|
58
|
+
ActiveInsulin = "ActiveInsulinLabel"
|
|
59
|
+
}
|
|
60
|
+
enum Unit {
|
|
61
|
+
BloodKetone = "BloodKetoneUnit",
|
|
62
|
+
BloodGlucose = "BloodGlucoseUnit",
|
|
63
|
+
ActiveInsulin = "ActiveInsulinUnit"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
57
66
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
BloodGlucose = "BloodGlucoseUnit",
|
|
61
|
-
ActiveInsulin = "ActiveInsulinUnit"
|
|
67
|
+
namespace Types {
|
|
68
|
+
type TestIdEnum = Id.ActivityTestIds | Id.HeaderTestIds | Id.LimitationMessageTestIds | Id.RecentInsulinTestIds | Id.RecommendedCarbsTestIds | Id.RecommendedInsulinTestIds | Id.RecommendationModalTestIds | Id.RemeasureTestIds | Id.TransferToLogbookTestIds | Id.TwoOptionModalTestIds | Id.InfoBarTestIds.Unit | Id.InfoBarTestIds.Value | Id.InfoBarTestIds.Label;
|
|
62
69
|
}
|
|
63
70
|
}
|
|
64
|
-
export declare type TestIdEnum = ActivityTestIds | HeaderTestIds | LimitationMessageTestIds | RecentInsulinTestIds | RecommendedCarbsTestIds | RecommendedInsulinTestIds | RecommendationModalTestIds | RemeasureTestIds | TransferToLogbookTestIds | TwoOptionModalTestIds | InfoBarTestIds.Unit | InfoBarTestIds.Value | InfoBarTestIds.Label;
|
|
65
71
|
export declare enum RecommendationErrorEnum {
|
|
66
72
|
ActivityDuration = 0,
|
|
67
73
|
ActivityTargetBGL = 1,
|