Skip to content

Commit

Permalink
attempts to add some additional testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jomurgel committed Sep 5, 2024
1 parent 81f5cba commit dad38ff
Show file tree
Hide file tree
Showing 12 changed files with 447 additions and 71 deletions.
2 changes: 1 addition & 1 deletion App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import useAuth from './src/hooks/useAuth'
/**
* Determines visibility of features based on user authentication.
*/
function AppNavigation(): ReactElement {
export function AppNavigation(): ReactElement {
const { session } = useAuth()
return ( session && session.user ? <AppStack /> : <AuthStack /> )
}
Expand Down
11 changes: 11 additions & 0 deletions __mocks__/@react-native-async-storage/async-storage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// __mocks__/@react-native-async-storage/async-storage.js
import { jest } from '@jest/globals'

const mockAsyncStorage = {
getItem: jest.fn( () => Promise.resolve( null ) ),
setItem: jest.fn( () => Promise.resolve() ),
removeItem: jest.fn( () => Promise.resolve() ),
clear: jest.fn( () => Promise.resolve() ),
}

export default mockAsyncStorage
8 changes: 5 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
function config( api ) {
module.exports = ( api ) => {
api.cache( true )
return {
presets: [
'babel-preset-expo',
'@babel/preset-typescript',
'@babel/preset-react',
],
plugins: [
'@babel/plugin-transform-runtime',
],
}
}

module.exports = config
15 changes: 3 additions & 12 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
module.exports = {
preset: 'jest-expo',
setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect'],
transform: {
'^.+\\.tsx?$': [ 'ts-jest', {
jsx: 'react',
module: 'commonjs',
target: 'es6',
strict: true,
esModuleInterop: true,
skipLibCheck: true,
forceConsistentCasingInFileNames: true,
types: [ 'jest', 'node' ],
} ],
'^.+\\.tsx?$': ['babel-jest'],
},
testPathIgnorePatterns: [ '/node_modules/', '/android/', '/ios/' ],
testEnvironment: 'node',
testEnvironment: 'jsdom',
moduleFileExtensions: [ 'js', 'jsx', 'ts', 'tsx' ],
}
Loading

0 comments on commit dad38ff

Please sign in to comment.