Skip to content

Commit

Permalink
Merge pull request #50 from Tchaikovsky1114/test/setting-test-environ…
Browse files Browse the repository at this point in the history
…ment

Set up the test environment and change configured preset
  • Loading branch information
gtokman authored Jul 9, 2024
2 parents 77a44a1 + b316b09 commit 63331d3
Show file tree
Hide file tree
Showing 5 changed files with 9,380 additions and 13,460 deletions.
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
presets: ['module:@react-native/babel-preset'],
};
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@
"devDependencies": {
"@commitlint/config-conventional": "^19.1.0",
"@evilmartians/lefthook": "^1.6.7",
"@react-native/babel-preset": "^0.74.85",
"@react-native/eslint-config": "^0.73.2",
"@release-it/conventional-changelog": "^8.0.1",
"@testing-library/jest-native": "^5.4.3",
"@testing-library/react-native": "^12.5.1",
"@types/jest": "^29.5.12",
"@types/react": "18.2.73",
"commitlint": "^19.2.1",
Expand All @@ -69,6 +72,7 @@
"react": "18.2.0",
"react-native": "0.73.6",
"react-native-builder-bob": "^0.23.2",
"react-test-renderer": "^18.3.1",
"release-it": "^17.1.1",
"typescript": "^5.4.3"
},
Expand All @@ -84,6 +88,12 @@
"modulePathIgnorePatterns": [
"<rootDir>/example/node_modules",
"<rootDir>/lib/"
],
"setupFilesAfterEnv": [
"<rootDir>/src/__tests__/setup.jest.ts"
],
"testPathIgnorePatterns": [
"<rootDir>/src/__tests__/setup.jest.ts"
]
},
"commitlint": {
Expand Down
18 changes: 18 additions & 0 deletions src/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { FasterImageView } from "..";
import React from "react";
import { render } from '@testing-library/react-native';

describe('index', () => {
it('check if the test is working', () => {
expect(true).toBe(true);
});

it('check test Image Rendering', () => {
const { toJSON } = render(<FasterImageView style={{
width: 100,
height: 100,
}} source={require('../../example/images/candle-logo.png')} />);
expect(toJSON()).toMatchSnapshot();
});

});
3 changes: 3 additions & 0 deletions src/__tests__/setup.jest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import '@testing-library/jest-native';
import '@testing-library/react-native/extend-expect';

Loading

0 comments on commit 63331d3

Please sign in to comment.