Skip to content

Commit 6c50fd3

Browse files
move all tests into __test__ folder
1 parent d80c3e2 commit 6c50fd3

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`snapshots : data props should be passed as props to generated component 1`] = `
4+
<div
5+
className="mock-class-name"
6+
id="mock-id"
7+
/>
8+
`;
9+
10+
exports[`snapshots : default render structure 1`] = `null`;

src/ctx.test.js renamed to __test__/ctx.test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Ctx from './ctx';
1+
import Ctx from '../src/ctx';
22
import React from 'react';
33
import * as Babel from '@babel/standalone';
44
beforeEach(() => {});
@@ -105,7 +105,6 @@ describe('methods : ', () => {
105105
expect(ins._updateTemplate.mock.calls[0][1]).toBe(babelOptions);
106106
expect(ins._updateComponent.mock.calls.length).toBe(1);
107107
expect(ins._updateComponent.mock.calls[0][0]).toBe('transpiled string code');
108-
expect(ins._updateComponent.mock.calls[0][1]).toBe(babelOptions);
109108
});
110109
test('_checkBabelOptions method should set react preset and inline sourceMaps and throw an error with invalid parameter', () => {
111110
expect.assertions(6);
@@ -151,7 +150,7 @@ describe('methods : ', () => {
151150
test('_import method', async () => {
152151
expect.assertions(1);
153152
const ins = new Ctx(React, Babel);
154-
await ins._import('./mock-module.js').then((res) => {
153+
await ins._import('../__test__/mock-module.js').then((res) => {
155154
expect(res.default || res).toBe('mock-module');
156155
});
157156
});
File renamed without changes.

src/stringToReact.test.js renamed to __test__/stringToReact.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import renderer from 'react-test-renderer';
33
import * as Babel from '@babel/standalone';
44
import {render, unmountComponentAtNode} from 'react-dom';
55
import {act} from 'react-dom/test-utils';
6-
import StrintToReact from './strintToReact';
7-
import Ctx from './ctx';
6+
import StrintToReact from '../src/strintToReact';
7+
import Ctx from '../src/ctx';
88
const react = React;
99
let container = document.createElement('div');
1010
const str = `()=><p id='someText'>some text</p>`;

tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"strict": true,
2727
"noUnusedLocals": true,
2828
"noUnusedParameters": true,
29-
"noFallthroughCasesInSwitch": true,
29+
"noFallthroughCasesInSwitch": true
3030
},
31-
"include": ["src"],
32-
"exclude": ["node_modules"],
31+
"include": ["src", "__test__/ctx.test.js", "__test__/stringToReact.test.js", "__test__/mock-module.js"],
32+
"exclude": ["node_modules"]
3333
}

0 commit comments

Comments
 (0)