Skip to content

Commit 3a2a517

Browse files
authored
Merge pull request #3 from afnx/feature/browser-logic
Feature/browser logic
2 parents 0ca0225 + 0dcd92e commit 3a2a517

15 files changed

Lines changed: 1291 additions & 73 deletions

File tree

__tests__/Index-test.tsx

Lines changed: 0 additions & 11 deletions
This file was deleted.

babel.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = function (api) {
2+
api.cache(true);
3+
return {
4+
presets: ['babel-preset-expo'],
5+
};
6+
};

eslint.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,19 @@ module.exports = defineConfig([
77
{
88
ignores: ['dist/*'],
99
},
10+
{
11+
files: ['**/__tests__/**/*', '**/*.test.*', '**/*.spec.*', '**/jest-setup.js'],
12+
languageOptions: {
13+
globals: {
14+
jest: 'readonly',
15+
describe: 'readonly',
16+
it: 'readonly',
17+
expect: 'readonly',
18+
beforeEach: 'readonly',
19+
afterEach: 'readonly',
20+
beforeAll: 'readonly',
21+
afterAll: 'readonly',
22+
},
23+
},
24+
},
1025
]);

jest-setup.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import 'react-native-gesture-handler/jestSetup';
2+
3+
// Mock react-native-reanimated
4+
jest.mock('react-native-reanimated', () => {
5+
const Reanimated = require('react-native-reanimated/mock');
6+
Reanimated.default.call = () => { };
7+
return Reanimated;
8+
});
9+
10+
// Mock AsyncStorage
11+
jest.mock('@react-native-async-storage/async-storage', () =>
12+
require('@react-native-async-storage/async-storage/jest/async-storage-mock')
13+
);
14+
15+
// Mock Animated to silence warnings
16+
jest.mock('react-native/Libraries/Animated/AnimatedImplementation', () => 'Animated');
17+
18+
// Additional React Native mocks for Expo
19+
jest.mock('expo-constants', () => ({
20+
default: {
21+
deviceId: 'test-device-id',
22+
experienceUrl: 'exp://test.com',
23+
},
24+
}));

jest.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
preset: 'jest-expo',
3+
setupFilesAfterEnv: ['<rootDir>/jest-setup.js'],
4+
transformIgnorePatterns: [
5+
"node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@sentry/react-native|native-base|react-native-svg)"
6+
],
7+
testEnvironment: 'jsdom',
8+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
9+
transform: {
10+
'^.+\\.(js|jsx|ts|tsx)$': 'babel-jest',
11+
},
12+
testPathIgnorePatterns: [
13+
'/__tests__/utils/', // ignores any __tests__/utils folder
14+
],
15+
};

0 commit comments

Comments
 (0)