Skip to content

Commit

Permalink
Add integration tests, pin versions in package.json
Browse files Browse the repository at this point in the history
Signed-off-by: petetnt <[email protected]>
  • Loading branch information
petetnt committed Jan 23, 2018
1 parent 53e215f commit d1dd2a8
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ describe('Integration', () => {
);
});

it('graphql files inclusion', async () => {
const doc = await initDOM('graphql-inclusion');
const children = doc.getElementById('graphql-inclusion').children;

// .graphql
expect(children[0].textContent.replace(/\s/g, '')).to.match(
'{"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}}'
);

// .gql
expect(children[1].textContent.replace(/\s/g, '')).to.match(
'{"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}}'
);
});

it('image inclusion', async () => {
const doc = await initDOM('image-inclusion');

Expand Down
11 changes: 8 additions & 3 deletions packages/react-scripts/fixtures/kitchensink/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ class App extends Component {
);
break;
case 'css-modules-inclusion':
import(
'./features/webpack/CssModulesInclusion'
).then(f => this.setFeature(f.default));
import('./features/webpack/CssModulesInclusion').then(f =>
this.setFeature(f.default)
);
break;
case 'custom-interpolation':
import('./features/syntax/CustomInterpolation').then(f =>
Expand All @@ -111,6 +111,11 @@ class App extends Component {
this.setFeature(f.default)
);
break;
case 'graphql-inclusion':
import('./features/webpack/GraphQLInclusion').then(f =>
this.setFeature(f.default)
);
break;
case 'image-inclusion':
import('./features/webpack/ImageInclusion').then(f =>
this.setFeature(f.default)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import A from './assets/graphql.graphql';
import B from './assets/graphql.gql';

export default () => (
<p id="graphql-inclusion">
<span>{JSON.stringify(A)}</span>
<span>{JSON.stringify(B)}</span>
</p>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import ReactDOM from 'react-dom';
import GraphQLInclusion from './GraphQLInclusion';

describe('graphql files inclusion', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<GraphQLInclusion />, div);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
test(test: "test") {
test
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
test(test: "test") {
test
}
}
6 changes: 3 additions & 3 deletions packages/react-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "1.1.6",
"fs-extra": "5.0.0",
"graphql": "^0.12.3",
"graphql-tag": "^2.6.1",
"graphql": "0.12.3",
"graphql-tag": "2.6.1",
"html-webpack-plugin": "2.30.1",
"identity-obj-proxy": "3.0.0",
"jest": "22.1.2",
"jest-transform-graphql": "^2.1.0",
"jest-transform-graphql": "2.1.0",
"object-assign": "4.1.1",
"postcss-flexbugs-fixes": "3.2.0",
"postcss-loader": "2.0.10",
Expand Down

0 comments on commit d1dd2a8

Please sign in to comment.