Skip to content

Commit

Permalink
tests(app): re-create test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
jankapunkt committed Sep 3, 2024
1 parent 928d2a0 commit 280acdd
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 6 deletions.
11 changes: 11 additions & 0 deletions app/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
preset: 'jest-expo',
transformIgnorePatterns: [
//'node_modules/(?!(jest-)?react-native|@meteorrn|@react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|@sentry/.*)'
'node_modules/(?!((jest-)?react-native|@meteorrn|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@sentry/react-native|native-base|react-native-svg)'
],
collectCoverage: true,
coverageDirectory: '.coverage',
coverageReporters: ['html'],
setupFiles: ['./jestSetup.js']
}
3 changes: 3 additions & 0 deletions app/jestSetup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
jest.mock('@react-native-async-storage/async-storage', () =>
require('@react-native-async-storage/async-storage/jest/async-storage-mock')
)
59 changes: 58 additions & 1 deletion app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"test": "jest --watchAll",
"test": "jest --coverage",
"docs": "jsdoc -c jsdoc.conf.json",
"lint": "expo lint",
"build:staging": "node build --type=staging",
"build:prod": "node build --type=production"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo/vector-icons": "^14.0.2",
"@meteorrn/core": "^2.8.2-rc.1",
Expand Down Expand Up @@ -59,6 +57,7 @@
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@testing-library/react-native": "^12.6.1",
"@types/jest": "^29.5.12",
"@types/react": "~18.2.45",
"@types/react-test-renderer": "^18.0.7",
Expand All @@ -68,7 +67,7 @@
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^17.10.2",
"eslint-plugin-promise": "^7.1.0",
"jest": "^29.2.1",
"jest": "^29.7.0",
"jest-expo": "~51.0.3",
"react-test-renderer": "18.2.0",
"typescript": "~5.3.3"
Expand Down
11 changes: 11 additions & 0 deletions app/prePublish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const sspkg = require('simpl-schema')
const SimpleSchema = sspkg.default
const settingsSchemaModule = require('./lib/settingsSchema.js')
const fs = require('fs')
const path = require('path')

const { settingsSchema } = settingsSchemaModule
const settingsStr = fs.readFileSync(path.resolve('src/lib/settings.json'), 'utf-8')
const settings = JSON.parse(settingsStr)
const schema = new SimpleSchema(settingsSchema)
schema.validate(settings)

0 comments on commit 280acdd

Please sign in to comment.