mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 13:51:27 +08:00
43 lines
837 B
TypeScript
43 lines
837 B
TypeScript
import Config from 'webpack-chain';
|
|
|
|
import {
|
|
mockExistsSync,
|
|
restoreExistsSync,
|
|
setHasTSConfig,
|
|
} from '../../scripts/jest.utils';
|
|
|
|
import react from '../../src/configuration/react';
|
|
import { init } from '../../src';
|
|
|
|
describe('react configuration', () => {
|
|
const platforms = ['ios', 'android'];
|
|
|
|
beforeAll(() => {
|
|
mockExistsSync();
|
|
setHasTSConfig(true);
|
|
});
|
|
|
|
afterAll(() => {
|
|
restoreExistsSync();
|
|
});
|
|
|
|
for (let platform of platforms) {
|
|
describe(`> ${platform} >`, () => {
|
|
it(`base config`, () => {
|
|
init({
|
|
[platform]: true,
|
|
});
|
|
expect(react(new Config()).toString()).toMatchSnapshot();
|
|
});
|
|
|
|
it(`adds ReactRefreshWebpackPlugin when HMR enabled`, () => {
|
|
init({
|
|
[platform]: true,
|
|
hmr: true,
|
|
});
|
|
expect(react(new Config()).toString()).toMatchSnapshot();
|
|
});
|
|
});
|
|
}
|
|
});
|