-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
81 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
module.exports = { | ||
preset: 'jest-expo', | ||
setupFilesAfterEnv: ['./jest.setup.ts'], | ||
setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect'], | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest', | ||
'^.+\\.tsx?$': [ 'ts-jest', { | ||
jsx: 'react', | ||
module: 'commonjs', | ||
target: 'es6', | ||
strict: true, | ||
esModuleInterop: true, | ||
skipLibCheck: true, | ||
forceConsistentCasingInFileNames: true, | ||
types: [ 'jest', 'node' ], | ||
} ], | ||
}, | ||
testPathIgnorePatterns: [ '/node_modules/', '/android/', '/ios/' ], | ||
globals: { | ||
'ts-jest': { | ||
tsconfig: 'tsconfig.jest.json', | ||
}, | ||
}, | ||
testEnvironment: 'node', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// @todo: need to adjust testing configs to support imports an file types. | ||
// import { renderHook } from '@testing-library/react' | ||
// import React, { ReactNode } from 'react' | ||
// import { | ||
// expect, describe, it, jest, | ||
// } from '@jest/globals' | ||
// import { User } from '@supabase/supabase-js' | ||
// import useAuth from './useAuth' | ||
// import { AuthContext } from '../providers/AuthProvider' | ||
// import { AuthContextType } from '../types/auth' | ||
|
||
// describe( 'useAuth', () => { | ||
// it( 'should throw an error if used outside of AuthProvider', () => { | ||
// const { result } = renderHook( () => useAuth() ) | ||
|
||
// // Expect the hook to throw an error when used outside the AuthProvider | ||
// expect( result.current.error ).toEqual( | ||
// new Error( 'useAuth must be used within an AuthProvider' ), | ||
// ) | ||
// } ) | ||
|
||
// it( 'should return the context value when used within AuthProvider', () => { | ||
// // @todo: need to setup a different parser for this. | ||
// // Mock the context value conforming to AuthContextType | ||
// const mockAuthContextValue: AuthContextType = { | ||
// error: null, | ||
// loading: false, | ||
// session: null, | ||
// // @ts-expect-error ignore for testing, not important. | ||
// signUpNewUser: ( jest.fn().mockResolvedValue( undefined ) as jest.Mock ), | ||
// // @ts-expect-error ignore for testing, not important. | ||
// signInWithEmail: ( jest.fn().mockResolvedValue( undefined ) as jest.Mock ), | ||
// // @ts-expect-error ignore for testing, not important. | ||
// signOut: ( jest.fn().mockResolvedValue( undefined ) as jest.Mock ), | ||
// user: { id: '1', email: 'test@example.com' } as User, // Mocking user object | ||
// } | ||
|
||
// // Define the wrapper component with the correct context value | ||
// const wrapper = ( { children }: { children: ReactNode } ) => ( | ||
// <AuthContext.Provider value={mockAuthContextValue}> | ||
// {children} | ||
// </AuthContext.Provider> | ||
// ) | ||
|
||
// const { result } = renderHook( () => useAuth(), { wrapper } ) | ||
|
||
// // Expect the hook to return the correct context value | ||
// expect( result.current ).toEqual( mockAuthContextValue ) | ||
// } ) | ||
// } ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
declare module 'expo-constants' { | ||
interface Constants { | ||
expoConfig: { | ||
extra: { | ||
GITHUB_CLIENT: string, | ||
SUPABASE_KEY: string, | ||
SUPABASE_CALLBACK: string, | ||
}; | ||
}; | ||
} | ||
} |