Skip to content

Commit 9deda17

Browse files
authored
Add linked modules test (facebook#1913)
1 parent 1479b36 commit 9deda17

File tree

5 files changed

+59
-1
lines changed

5 files changed

+59
-1
lines changed

fixtures/kitchensink/.template.dependencies.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"babel-polyfill": "6.20.0",
66
"chai": "3.5.0",
77
"jsdom": "9.8.3",
8-
"mocha": "3.2.0"
8+
"mocha": "3.2.0",
9+
"test-integrity": "1.0.0"
910
}
1011
}

fixtures/kitchensink/integration/webpack.test.js

+8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ describe('Integration', () => {
4444
);
4545
});
4646

47+
it('linked modules', async () => {
48+
const doc = await initDOM('linked-modules');
49+
50+
expect(doc.getElementById('feature-linked-modules').textContent).to.equal(
51+
'2.0.0'
52+
);
53+
});
54+
4755
it('svg inclusion', async () => {
4856
const doc = await initDOM('svg-inclusion');
4957

fixtures/kitchensink/src/App.js

+4
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ class App extends Component {
111111
import('./features/webpack/JsonInclusion').then(f =>
112112
this.setFeature(f.default));
113113
break;
114+
case 'linked-modules':
115+
import('./features/webpack/LinkedModules').then(f =>
116+
this.setFeature(f.default));
117+
break;
114118
case 'node-path':
115119
import('./features/env/NodePath').then(f => this.setFeature(f.default));
116120
break;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
10+
import React from 'react';
11+
import './assets/style.css';
12+
import { test, version } from 'test-integrity';
13+
14+
export default () => {
15+
const v = version();
16+
if (!test() || v !== '2.0.0') {
17+
throw new Error('Functionality test did not pass.');
18+
}
19+
return <p id="feature-linked-modules">{v}</p>;
20+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
10+
import React from 'react';
11+
import ReactDOM from 'react-dom';
12+
import { test, version } from 'test-integrity';
13+
import LinkedModules from './LinkedModules';
14+
15+
describe('linked modules', () => {
16+
it('has integrity', () => {
17+
expect(test());
18+
expect(version() === '2.0.0');
19+
});
20+
21+
it('renders without crashing', () => {
22+
const div = document.createElement('div');
23+
ReactDOM.render(<LinkedModules />, div);
24+
});
25+
});

0 commit comments

Comments
 (0)