Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commitae2903c

Browse files
committed
use mocks for unit tests
1 parent7e47db2 commitae2903c

File tree

14 files changed

+83
-36
lines changed

14 files changed

+83
-36
lines changed

‎lib/__mocks__/editor.js‎

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎lib/__mocks__/editor.js.map‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎lib/modules/dir/index.js‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎lib/modules/dir/index.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"repository":"https://github.com/coderoad/core-coderoad",
2626
"scripts": {
2727
"compile":"tsc",
28-
"test":"jest"
28+
"test":"jest",
29+
"mocks":"tsc -p ./src/__mocks__"
2930
},
3031
"dependencies": {
3132
"atom-plugin-command-line":"1.0.2",

‎src/__mocks__/editor/index.js‎

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎src/__mocks__/editor/index.js.map‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎src/__mocks__/editor/index.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* Pass in a configuration object to the mock
3+
*/
4+
exportconsteditor={
5+
name:'editorName',
6+
directory:()=>'./path/to/dir',
7+
};

‎src/__mocks__/tsconfig.json‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"compilerOptions": {
3+
"target":"ES5",
4+
"module":"commonjs",
5+
"declaration":false,
6+
"noImplicitAny":false,
7+
"removeComments":true,
8+
"jsx":"react",
9+
"experimentalDecorators":true,
10+
"emitDecoratorMetadata":true,
11+
"sourceMap":true,
12+
"moduleResolution":"node",
13+
"strictNullChecks":true
14+
},
15+
"filesGlob": [
16+
"*.ts",
17+
"**/*.ts",
18+
"*.tsx",
19+
"**/*.tsx"
20+
],
21+
"files": [
22+
"editor/index.ts"
23+
]
24+
}

‎src/components/Start/Start.test.tsx‎

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
11
/// <reference path="../../typings/globals/jest/index.d.ts" />
2+
/// <reference path="../../typings/globals/react/index.d.ts" />
3+
/// <reference path="../../typings/globals/react-redux/index.d.ts" />
4+
/// <reference path="../../typings/globals/react-test-renderer/index.d.ts" />
25

36
import*asReactfrom'react';
47
import*asrendererfrom'react-test-renderer';
58

6-
importStartfrom'./index';
7-
import{Provider}from'react-redux';
9+
//import Start from './index';
10+
//import { Provider } from 'react-redux';
811

912

10-
import'../../__tests__/mocks';
11-
importmockStorefrom'../../__tests__/mocks/store';
13+
//import '../../__tests__/mocks';
14+
//import mockStore from '../../__tests__/mocks/store';
1215

13-
describe('<Start />',()=>{
16+
xdescribe('<Start />',()=>{
1417

15-
it('renders <Welcome /> if checks pass',()=>{
16-
conststore=mockStore({
17-
checks:{
18-
passed:false
19-
}
20-
});
21-
consttree=renderer.create(
22-
<Providerstore={store}>
23-
<Start/>
24-
</Provider>
25-
).toJSON();
26-
expect(tree).toMatchSnapshot();
18+
xit('renders <Welcome /> if checks pass',()=>{
19+
//const store = mockStore({
20+
// checks: {
21+
// passed: false
22+
// }
23+
//});
24+
//const tree = renderer.create(
25+
// <Provider store={store}>
26+
// <Start />
27+
// </Provider>
28+
//).toJSON();
29+
//expect(tree).toMatchSnapshot();
2730
});
2831

2932
// xit('renders <Checks /> if check fails', () => {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp