Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,36 @@ jobs:
- name: Run ESLint check
run: npx eslint . --max-warnings=0

tests:
name: tests
runs-on: ubuntu-latest
env:
EXPO_PUBLIC_SUPABASE_URL: ${{ secrets.EXPO_PUBLIC_SUPABASE_URL }}
EXPO_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.EXPO_PUBLIC_SUPABASE_ANON_KEY }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache node modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install dependencies
run: npm ci

- name: Run tests check
run: npx jest

build:
name: type
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,9 @@ yarn-error.*

# typescript
*.tsbuildinfo

# jest
coverage/
test_output.txt
coverage.txt
coverage_report.txt
5 changes: 5 additions & 0 deletions __mocks__/expo-splash-screen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* eslint-disable no-undef */
module.exports = {
preventAutoHideAsync: jest.fn(),
hideAsync: jest.fn(),
};
1 change: 1 addition & 0 deletions __mocks__/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'test-file-stub';
5 changes: 5 additions & 0 deletions __mocks__/react-native-reanimated.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Reanimated = require('react-native-reanimated/mock');

Reanimated.default.call = () => {};

module.exports = Reanimated;
1 change: 1 addition & 0 deletions __mocks__/react-native-worklets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
1 change: 1 addition & 0 deletions __mocks__/styleMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {};
7 changes: 5 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
module.exports = function (api) {
api.cache(true);
const isTest = api.env('test');

return {
presets: [['babel-preset-expo', { jsxImportSource: 'nativewind' }], 'nativewind/babel'],
plugins: ['module:react-native-dotenv'],
plugins: [!isTest && 'react-native-reanimated/plugin', 'module:react-native-dotenv'].filter(
Boolean
),
};
};
18 changes: 18 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import '@testing-library/jest-native/extend-expect';
import { jest } from '@jest/globals';

jest.mock('react-native-reanimated', () => require('__mocks__/react-native-reanimated'));
jest.mock('react-native-worklets', () => require('__mocks__/react-native-worklets'));

jest.mock('@react-native-async-storage/async-storage', () => ({
setItem: jest.fn(() => Promise.resolve()),
getItem: jest.fn(() => Promise.resolve(null)),
removeItem: jest.fn(() => Promise.resolve()),
multiSet: jest.fn(() => Promise.resolve()),
multiGet: jest.fn(() => Promise.resolve([])),
clear: jest.fn(() => Promise.resolve()),
}));

jest.mock('*.css', () => ({}));
jest.mock('*.png', () => ({}));
jest.mock('*.jpg', () => ({}));
Loading