diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 00000000..e30aa2cf
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,10 @@
+version: 2
+updates:
+ - package-ecosystem: 'npm'
+ directory: '/'
+ schedule:
+ interval: 'daily'
+ time: '21:00'
+ open-pull-requests-limit: 20
+ ignore:
+ - dependency-name: 'react-native'
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 00000000..9ef54c25
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,40 @@
+name: Git Checks
+
+on: [push]
+
+jobs:
+ build:
+ name: Run tests, linter, TS
+ runs-on: macOS-latest
+
+ steps:
+ - name: Check out Git repository
+ uses: actions/checkout@v2
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v1
+ with:
+ node-version: 12
+
+ - name: Install dependencies
+ run: yarn
+
+ - name: Pod Install
+ working-directory: ios
+ run: pod install
+
+ # TS
+ - name: Run TypeScript
+ run: yarn tsc
+
+ # Run linter
+ - name: Run linter
+ run: yarn lint
+
+ # Run Prettier
+ - name: Run prettier
+ run: yarn prettier
+
+ # Tests
+ - name: Run unit tests
+ run: yarn jest
\ No newline at end of file
diff --git a/.github/workflows/ts-ignore-counter.yml b/.github/workflows/ts-ignore-counter.yml
new file mode 100644
index 00000000..c1a00ac2
--- /dev/null
+++ b/.github/workflows/ts-ignore-counter.yml
@@ -0,0 +1,48 @@
+name: TypeScript '@ts-ignore' counter
+on: push
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Dump GitHub context
+ env:
+ GITHUB_CONTEXT: ${{ toJson(github) }}
+ run: echo "$GITHUB_CONTEXT"
+ - uses: actions/checkout@v2
+ with:
+ ref: master
+ - name: Count ts-ignore on master
+ id: before
+ run: |
+ export BEFORE=`find . -type f \( -name "*.ts" -or -name "*.tsx" \) -exec grep -o "@ts-ignore" {} \; |wc -l`
+ echo "::set-output name=count::$BEFORE"
+ - uses: actions/checkout@v2
+ - name: Count ts-ignore on this commit
+ id: after
+ run: |
+ export AFTER=`find . -type f \( -name "*.ts" -or -name "*.tsx" \) -exec grep -o "@ts-ignore" {} \; |wc -l`
+ echo "::set-output name=count::$AFTER"
+ - name: Do the math
+ id: result
+ run: |
+ export BEFORE="${{ steps.before.outputs.count }}"
+ export AFTER="${{ steps.after.outputs.count }}"
+ if [[ `expr $AFTER - $BEFORE` -gt 0 ]]; then
+ export DIFF=`expr $AFTER - $BEFORE`
+ export CHANGE="(went up by $DIFF) "
+ for n in $(seq $DIFF); do export CHANGE="$CHANGE:broken_heart:"; done
+ elif [[ `expr $BEFORE - $AFTER` -gt 0 ]]; then
+ export DIFF=`expr $BEFORE - $AFTER`
+ export CHANGE="(went down by $DIFF) "
+ for n in $(seq $DIFF); do export CHANGE="$CHANGE:sparkles:"; done
+ else
+ export CHANGE="(unchanged)"
+ fi
+ echo "::set-output name=comment::**ts-ignore**'s: $AFTER $CHANGE"
+ - name: Post issue comment
+ run: |
+ jq --arg msg "${{ steps.result.outputs.comment }}" -nc '{"body": $msg}' | \
+ curl -sL -X POST -d @- \
+ -H "Content-Type: application/json" \
+ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
+ "https://api.github.com/repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/comments"
\ No newline at end of file
diff --git a/__mocks__/react-native-device-info.js b/__mocks__/react-native-device-info.js
new file mode 100644
index 00000000..250db168
--- /dev/null
+++ b/__mocks__/react-native-device-info.js
@@ -0,0 +1,32 @@
+module.exports = {
+ getUserAgent: () => "TestUser/Agent",
+ getManufacturer: () => "Apple",
+ getDeviceId: () => "DeviceId",
+ getSystemVersion: () => "10.0",
+ getReadableVersion: () => "1.0.0.1",
+ getApplicationName: () => "Mindful Chef (Dev)",
+ isEmulator: () => true,
+ isTablet: () => false,
+ getModel: () => "Mock iPhone 12",
+ getVersion: jest.fn(() => Promise.resolve("24.0")),
+ getBundleId: jest.fn(() => Promise.resolve("com.mindfulchef.uat")),
+ getBuildNumber: jest.fn(() => Promise.resolve("3.0.0")),
+ getIpAddress: jest.fn(() => Promise.resolve("10.158.70.93")),
+ getUniqueID: jest.fn(),
+ getBrand: jest.fn(),
+ getSystemName: jest.fn(),
+ getDeviceName: jest.fn(),
+ getDeviceLocale: jest.fn(),
+ getDeviceCountry: jest.fn(),
+ getTimezone: jest.fn(),
+ is24Hour: jest.fn(),
+ isPinOrFingerprintSet: jest.fn(),
+ getAPILevel: jest.fn(),
+ getInstanceID: jest.fn(),
+ getPhoneNumber: jest.fn(),
+ getFirstInstallTime: jest.fn(),
+ getLastUpdateTime: jest.fn(),
+ getSerialNumber: jest.fn(),
+ getMACAddress: jest.fn(),
+ getCarrier: jest.fn(),
+};
diff --git a/__mocks__/react-native-permissions.js b/__mocks__/react-native-permissions.js
new file mode 100644
index 00000000..bec05185
--- /dev/null
+++ b/__mocks__/react-native-permissions.js
@@ -0,0 +1,3 @@
+module.exports = {
+ checkNotifications: () => true,
+};
diff --git a/package.json b/package.json
index 40d9d570..51cec973 100644
--- a/package.json
+++ b/package.json
@@ -86,7 +86,7 @@
"react-test-renderer": "~16.13.1",
"redux-devtools-extension": "^2.13.8",
"redux-logger": "^3.0.6",
- "ts-jest": "^26.1.3",
+ "ts-jest": "^26.5.4",
"typescript": "^3.7.5"
},
"private": true,
diff --git a/src/components/__tests__/ButtonWithIcon.spec.tsx b/src/components/__tests__/ButtonWithIcon.spec.tsx
index d25b5d17..e48bbdb0 100644
--- a/src/components/__tests__/ButtonWithIcon.spec.tsx
+++ b/src/components/__tests__/ButtonWithIcon.spec.tsx
@@ -6,7 +6,7 @@ import ButtonWithIcon from "../ButtonWithIcon";
it(`renders correctly`, () => {
const defaultProps = {
label: "Google",
- icon: "Icon",
+ icon: "add",
onPress: () => {},
};
const tree = renderer.create().toJSON();
diff --git a/src/components/__tests__/__snapshots__/ButtonWithIcon.spec.tsx.snap b/src/components/__tests__/__snapshots__/ButtonWithIcon.spec.tsx.snap
index 210075f4..d7946203 100644
--- a/src/components/__tests__/__snapshots__/ButtonWithIcon.spec.tsx.snap
+++ b/src/components/__tests__/__snapshots__/ButtonWithIcon.spec.tsx.snap
@@ -72,7 +72,7 @@ exports[`renders correctly 1`] = `
]
}
>
- ?
+
+ Google.com
+
+
-
+ , ,
-
- Google.com
-
-
- , ,
-
+ "alignItems": "center",
+ "backgroundColor": "#f7f7f7",
+ "flex": 1,
+ "height": 100,
+ "justifyContent": "center",
+ "width": 100,
+ }
+ }
+ >
+
+
+
+
+
`;
diff --git a/src/screens/__tests__/__snapshots__/SettingsScreen.spec.tsx.snap b/src/screens/__tests__/__snapshots__/SettingsScreen.spec.tsx.snap
new file mode 100644
index 00000000..45b807ca
--- /dev/null
+++ b/src/screens/__tests__/__snapshots__/SettingsScreen.spec.tsx.snap
@@ -0,0 +1,501 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`SettingsScreen renders the SettingsScreen screen 1`] = `
+
+
+
+
+
+
+ Your details
+
+
+
+
+
+
+ Name
+
+
+ John
+
+ Doe
+
+
+
+
+ Email
+
+
+ test@test.com
+
+
+
+
+ App version
+
+
+
+
+
+
+
+ UUID
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Terms & Conditions
+
+
+
+
+
+
+
+
+
+
+
+
+ Contact
+
+
+
+
+
+
+
+
+
+
+
+
+ Logout
+
+
+
+
+
+
+`;
diff --git a/src/store/reducers/__tests__/data.spec.tsx b/src/store/reducers/__tests__/data.spec.tsx
index 2b6fe68a..16ef6f05 100644
--- a/src/store/reducers/__tests__/data.spec.tsx
+++ b/src/store/reducers/__tests__/data.spec.tsx
@@ -9,7 +9,6 @@ describe("Data reducer", () => {
});
expect(state).toEqual({
- data: [],
universities: [],
});
});
@@ -22,7 +21,7 @@ describe("Data reducer", () => {
payload,
});
- expect(state).toEqual({ data: [], universities: ["mock"] });
+ expect(state).toEqual({ universities: ["mock"] });
});
it("DATA_FETCHED_FAILURE", () => {
@@ -33,6 +32,6 @@ describe("Data reducer", () => {
payload,
});
- expect(state).toEqual({ data: [], universities: [] });
+ expect(state).toEqual({ universities: [] });
});
});
diff --git a/yarn.lock b/yarn.lock
index 36ed8e43..6a78303f 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1244,15 +1244,6 @@
"@types/yargs" "^15.0.0"
chalk "^3.0.0"
-"@jest/types@^26.1.0":
- version "26.1.0"
- resolved "https://registry.npmjs.org/@jest/types/-/types-26.1.0.tgz#f8afaaaeeb23b5cad49dd1f7779689941dcb6057"
- dependencies:
- "@types/istanbul-lib-coverage" "^2.0.0"
- "@types/istanbul-reports" "^1.1.1"
- "@types/yargs" "^15.0.0"
- chalk "^4.0.0"
-
"@jest/types@^26.6.2":
version "26.6.2"
resolved "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e"
@@ -4922,16 +4913,6 @@ jest-snapshot@^25.5.1:
pretty-format "^25.5.0"
semver "^6.3.0"
-jest-util@26.x:
- version "26.1.0"
- resolved "https://registry.npmjs.org/jest-util/-/jest-util-26.1.0.tgz#80e85d4ba820decacf41a691c2042d5276e5d8d8"
- dependencies:
- "@jest/types" "^26.1.0"
- chalk "^4.0.0"
- graceful-fs "^4.2.4"
- is-ci "^2.0.0"
- micromatch "^4.0.2"
-
jest-util@^24.9.0:
version "24.9.0"
resolved "https://registry.npmjs.org/jest-util/-/jest-util-24.9.0.tgz#7396814e48536d2e85a37de3e4c431d7cb140162"
@@ -4959,7 +4940,7 @@ jest-util@^25.5.0:
is-ci "^2.0.0"
make-dir "^3.0.0"
-jest-util@^26.6.2:
+jest-util@^26.1.0, jest-util@^26.6.2:
version "26.6.2"
resolved "https://registry.npmjs.org/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1"
integrity sha512-MDW0fKfsn0OI7MS7Euz6h8HNDXVQ0gaM9uW6RjfDmd1DAFcaxX9OqIakHIqhbnmF08Cf2DLDG+ulq8YQQ0Lp0Q==
@@ -5303,10 +5284,6 @@ lodash.get@^4.3.0, lodash.get@^4.4.2:
version "4.4.2"
resolved "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
-lodash.memoize@4.x:
- version "4.1.2"
- resolved "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
-
lodash.sortby@^4.7.0:
version "4.7.0"
resolved "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
@@ -5319,9 +5296,10 @@ lodash.zip@^4.2.0:
version "4.2.0"
resolved "https://registry.npmjs.org/lodash.zip/-/lodash.zip-4.2.0.tgz#ec6662e4896408ed4ab6c542a3990b72cc080020"
-lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.4, lodash@^4.3.0, lodash@^4.5.0:
- version "4.17.19"
- resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
+lodash@4.x, lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.4, lodash@^4.3.0, lodash@^4.5.0:
+ version "4.17.21"
+ resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
+ integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
log-symbols@^2.2.0:
version "2.2.0"
@@ -7960,20 +7938,21 @@ tr46@^1.0.1:
dependencies:
punycode "^2.1.0"
-ts-jest@^26.1.3:
- version "26.1.3"
- resolved "https://registry.npmjs.org/ts-jest/-/ts-jest-26.1.3.tgz#aac928a05fdf13e3e6dfbc8caec3847442667894"
+ts-jest@^26.5.4:
+ version "26.5.4"
+ resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.4.tgz#207f4c114812a9c6d5746dd4d1cdf899eafc9686"
+ integrity sha512-I5Qsddo+VTm94SukBJ4cPimOoFZsYTeElR2xy6H2TOVs+NsvgYglW8KuQgKoApOKuaU/Ix/vrF9ebFZlb5D2Pg==
dependencies:
bs-logger "0.x"
buffer-from "1.x"
fast-json-stable-stringify "2.x"
- jest-util "26.x"
+ jest-util "^26.1.0"
json5 "2.x"
- lodash.memoize "4.x"
+ lodash "4.x"
make-error "1.x"
mkdirp "1.x"
semver "7.x"
- yargs-parser "18.x"
+ yargs-parser "20.x"
tsconfig-paths@^3.9.0:
version "3.9.0"
@@ -8468,12 +8447,10 @@ yallist@^2.1.2:
version "2.1.2"
resolved "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
-yargs-parser@18.x, yargs-parser@^18.1.2:
- version "18.1.3"
- resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"
- dependencies:
- camelcase "^5.0.0"
- decamelize "^1.2.0"
+yargs-parser@20.x:
+ version "20.2.7"
+ resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.7.tgz#61df85c113edfb5a7a4e36eb8aa60ef423cbc90a"
+ integrity sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==
yargs-parser@^15.0.1:
version "15.0.1"
@@ -8482,6 +8459,13 @@ yargs-parser@^15.0.1:
camelcase "^5.0.0"
decamelize "^1.2.0"
+yargs-parser@^18.1.2:
+ version "18.1.3"
+ resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"
+ dependencies:
+ camelcase "^5.0.0"
+ decamelize "^1.2.0"
+
yargs@^14.2.0:
version "14.2.3"
resolved "https://registry.npmjs.org/yargs/-/yargs-14.2.3.tgz#1a1c3edced1afb2a2fea33604bc6d1d8d688a414"