Skip to content

Commit d1dd2a8

Browse files
committed
Add integration tests, pin versions in package.json
Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
1 parent 53e215f commit d1dd2a8

File tree

7 files changed

+70
-6
lines changed

7 files changed

+70
-6
lines changed

packages/react-scripts/fixtures/kitchensink/integration/webpack.test.js

+15
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,21 @@ describe('Integration', () => {
3131
);
3232
});
3333

34+
it('graphql files inclusion', async () => {
35+
const doc = await initDOM('graphql-inclusion');
36+
const children = doc.getElementById('graphql-inclusion').children;
37+
38+
// .graphql
39+
expect(children[0].textContent.replace(/\s/g, '')).to.match(
40+
'{"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","variableDefinitions":[],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"test"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"test"},"value":{"kind":"StringValue","value":"test","block":false}}],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"test"},"arguments":[],"directives":[]}]}}]}}],"loc":{"start":0,"end":41}}'
41+
);
42+
43+
// .gql
44+
expect(children[1].textContent.replace(/\s/g, '')).to.match(
45+
'{"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","variableDefinitions":[],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"test"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"test"},"value":{"kind":"StringValue","value":"test","block":false}}],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"test"},"arguments":[],"directives":[]}]}}]}}],"loc":{"start":0,"end":41}}'
46+
);
47+
});
48+
3449
it('image inclusion', async () => {
3550
const doc = await initDOM('image-inclusion');
3651

packages/react-scripts/fixtures/kitchensink/src/App.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ class App extends Component {
8282
);
8383
break;
8484
case 'css-modules-inclusion':
85-
import(
86-
'./features/webpack/CssModulesInclusion'
87-
).then(f => this.setFeature(f.default));
85+
import('./features/webpack/CssModulesInclusion').then(f =>
86+
this.setFeature(f.default)
87+
);
8888
break;
8989
case 'custom-interpolation':
9090
import('./features/syntax/CustomInterpolation').then(f =>
@@ -111,6 +111,11 @@ class App extends Component {
111111
this.setFeature(f.default)
112112
);
113113
break;
114+
case 'graphql-inclusion':
115+
import('./features/webpack/GraphQLInclusion').then(f =>
116+
this.setFeature(f.default)
117+
);
118+
break;
114119
case 'image-inclusion':
115120
import('./features/webpack/ImageInclusion').then(f =>
116121
this.setFeature(f.default)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Copyright (c) 2018-present, Facebook, Inc.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
import React from 'react';
9+
import A from './assets/graphql.graphql';
10+
import B from './assets/graphql.gql';
11+
12+
export default () => (
13+
<p id="graphql-inclusion">
14+
<span>{JSON.stringify(A)}</span>
15+
<span>{JSON.stringify(B)}</span>
16+
</p>
17+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Copyright (c) 2018-present, Facebook, Inc.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
import React from 'react';
9+
import ReactDOM from 'react-dom';
10+
import GraphQLInclusion from './GraphQLInclusion';
11+
12+
describe('graphql files inclusion', () => {
13+
it('renders without crashing', () => {
14+
const div = document.createElement('div');
15+
ReactDOM.render(<GraphQLInclusion />, div);
16+
});
17+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
test(test: "test") {
3+
test
4+
}
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
test(test: "test") {
3+
test
4+
}
5+
}

packages/react-scripts/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@
4444
"extract-text-webpack-plugin": "3.0.2",
4545
"file-loader": "1.1.6",
4646
"fs-extra": "5.0.0",
47-
"graphql": "^0.12.3",
48-
"graphql-tag": "^2.6.1",
47+
"graphql": "0.12.3",
48+
"graphql-tag": "2.6.1",
4949
"html-webpack-plugin": "2.30.1",
5050
"identity-obj-proxy": "3.0.0",
5151
"jest": "22.1.2",
52-
"jest-transform-graphql": "^2.1.0",
52+
"jest-transform-graphql": "2.1.0",
5353
"object-assign": "4.1.1",
5454
"postcss-flexbugs-fixes": "3.2.0",
5555
"postcss-loader": "2.0.10",

0 commit comments

Comments
 (0)