Skip to content

Commit

Permalink
build(common): ui testing integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Yorsh committed Oct 30, 2018
1 parent 6b9825b commit 7b45ad7
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 67 deletions.
3 changes: 1 addition & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ module.exports = {
"js",
],
"transform": {
"src\/.*.(js|jsx)$": "babel-jest",
"src\/.*.(ts|tsx)$": "ts-jest",
"src\/.*.(ts|tsx)$": "babel-jest",
},
"testRegex": "src\\/.*\\.spec\\.(ts|tsx)$",
};
93 changes: 36 additions & 57 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@
"@types/jest": "^23.3.8",
"@types/react": "^16.4.18",
"@types/react-native": "^0.57.7",
"@types/react-test-renderer": "^16.0.3",
"babel-jest": "^23.6.0",
"babel-preset-react-native": "^4.0.1",
"husky": "^1.1.2",
"jest": "^23.6.0",
"react": "^16.6.0",
"react-native": "^0.57.4",
"react-native-testing-library": "^1.3.0",
"react-native-typescript-transformer": "^1.2.10",
"react-test-renderer": "^16.6.0",
"rimraf": "^2.6.2",
"ts-jest": "^23.10.4",
"tslint": "^5.11.0",
"typescript": "^3.1.3"
}
Expand Down
7 changes: 0 additions & 7 deletions src/framework/ui/sample/sample.component.spec.ts

This file was deleted.

20 changes: 20 additions & 0 deletions src/framework/ui/sample/sample.component.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import * as UITest from 'react-native-testing-library';
import {Sample} from './sample.component';

it('Checks Sample component renders correctly', async () => {
const component = UITest.render(
<Sample/>,
);
const textComponent = component.getByName('Text');
expect(textComponent).not.toBeNull();
});

it('Checks Sample component passes correct text props', async () => {
const text = 'Hello, World!';
const component = UITest.render(
<Sample text={text}/>,
);
const textComponent = component.getByName('Text');
expect(textComponent.props.children).toEqual(text);
});

0 comments on commit 7b45ad7

Please sign in to comment.