Skip to content

Commit

Permalink
Add linked modules test (facebook#1913)
Browse files Browse the repository at this point in the history
  • Loading branch information
Timer authored Apr 15, 2017
1 parent 1479b36 commit 9deda17
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fixtures/kitchensink/.template.dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"babel-polyfill": "6.20.0",
"chai": "3.5.0",
"jsdom": "9.8.3",
"mocha": "3.2.0"
"mocha": "3.2.0",
"test-integrity": "1.0.0"
}
}
8 changes: 8 additions & 0 deletions fixtures/kitchensink/integration/webpack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ describe('Integration', () => {
);
});

it('linked modules', async () => {
const doc = await initDOM('linked-modules');

expect(doc.getElementById('feature-linked-modules').textContent).to.equal(
'2.0.0'
);
});

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

Expand Down
4 changes: 4 additions & 0 deletions fixtures/kitchensink/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ class App extends Component {
import('./features/webpack/JsonInclusion').then(f =>
this.setFeature(f.default));
break;
case 'linked-modules':
import('./features/webpack/LinkedModules').then(f =>
this.setFeature(f.default));
break;
case 'node-path':
import('./features/env/NodePath').then(f => this.setFeature(f.default));
break;
Expand Down
20 changes: 20 additions & 0 deletions fixtures/kitchensink/src/features/webpack/LinkedModules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

import React from 'react';
import './assets/style.css';
import { test, version } from 'test-integrity';

export default () => {
const v = version();
if (!test() || v !== '2.0.0') {
throw new Error('Functionality test did not pass.');
}
return <p id="feature-linked-modules">{v}</p>;
};
25 changes: 25 additions & 0 deletions fixtures/kitchensink/src/features/webpack/LinkedModules.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

import React from 'react';
import ReactDOM from 'react-dom';
import { test, version } from 'test-integrity';
import LinkedModules from './LinkedModules';

describe('linked modules', () => {
it('has integrity', () => {
expect(test());
expect(version() === '2.0.0');
});

it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<LinkedModules />, div);
});
});

0 comments on commit 9deda17

Please sign in to comment.