Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump jest from 25.1.0 to 26.6.3 #126

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions .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'
40 changes: 40 additions & 0 deletions .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
48 changes: 48 additions & 0 deletions .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"
32 changes: 32 additions & 0 deletions __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(),
};
3 changes: 3 additions & 0 deletions __mocks__/react-native-permissions.js
@@ -0,0 +1,3 @@
module.exports = {
checkNotifications: () => true,
};
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -77,7 +77,7 @@
"eslint-plugin-react-native": "^3.7.0",
"eslint-plugin-simple-import-sort": "^4.0.0",
"eslint-plugin-standard": "^4.0.1",
"jest": "~25.1.0",
"jest": "~26.6.3",
"metro-config": "^0.64.0",
"metro-react-native-babel-preset": "~0.59.0",
"prettier": "^2.0.5",
Expand Down
2 changes: 1 addition & 1 deletion src/components/__tests__/ButtonWithIcon.spec.tsx
Expand Up @@ -6,7 +6,7 @@ import ButtonWithIcon from "../ButtonWithIcon";
it(`renders correctly`, () => {
const defaultProps = {
label: "Google",
icon: "Icon",
icon: "add",
onPress: () => {},
};
const tree = renderer.create(<ButtonWithIcon {...defaultProps} />).toJSON();
Expand Down
Expand Up @@ -72,7 +72,7 @@ exports[`renders correctly 1`] = `
]
}
>
?
</Text>
</View>
<Text
Expand Down
104 changes: 63 additions & 41 deletions src/components/__tests__/__snapshots__/Card.spec.tsx.snap
Expand Up @@ -21,10 +21,12 @@ exports[`renders correctly 1`] = `
style={
Object {
"alignItems": "flex-start",
"borderColor": "#D4AF37",
"borderColor": "#BABABA",
"borderRadius": 6,
"borderWidth": 1,
"display": "flex",
"flexDirection": "row",
"justifyContent": "space-between",
"marginBottom": 12,
"padding": 12,
"width": "100%",
Expand All @@ -34,65 +36,85 @@ exports[`renders correctly 1`] = `
<View
style={
Object {
"alignItems": "center",
"backgroundColor": "#f7f7f7",
"flexDirection": "row",
"height": 150,
"justifyContent": "center",
"width": "100%",
"width": "60%",
}
}
>
<Text
allowFontScaling={false}
style={
Array [
Object {
"color": undefined,
"fontSize": 60,
},
Object {
"color": "#BABABA",
"color": "#000",
"fontWeight": "bold",
"marginTop": 12,
"overflow": "hidden",
},
]
}
>
Google.com
</Text>
<Text
style={
Array [
Object {
"fontFamily": "Ionicons",
"fontStyle": "normal",
"fontWeight": "normal",
"color": "#000",
"overflow": "hidden",
"paddingTop": 12,
},
Object {},
]
}
>
, ,
</Text>
</View>
<Text
<View
style={
Array [
Object {
"color": "#D4AF37",
"fontWeight": "bold",
"marginTop": 12,
"overflow": "hidden",
},
]
Object {
"alignItems": "flex-end",
"width": "40%",
}
}
>
Google.com
</Text>
<Text
style={
Array [
<View
style={
Object {
"color": "#000",
"overflow": "hidden",
"paddingTop": 12,
},
]
}
>
, ,
</Text>
"alignItems": "center",
"backgroundColor": "#f7f7f7",
"flex": 1,
"height": 100,
"justifyContent": "center",
"width": 100,
}
}
>
<Text
allowFontScaling={false}
style={
Array [
Object {
"color": undefined,
"fontSize": 35,
},
Object {
"alignSelf": "center",
"color": "#BABABA",
"margin": 0,
"padding": 0,
},
Object {
"fontFamily": "Ionicons",
"fontStyle": "normal",
"fontWeight": "normal",
},
Object {},
]
}
>
</Text>
</View>
</View>
</View>
</View>
`;