-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
change-main-to-class-name-14-0-2.spec.ts
48 lines (41 loc) · 1.37 KB
/
change-main-to-class-name-14-0-2.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { addProjectConfiguration, Tree } from '@nrwl/devkit';
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import update from './change-main-to-class-name-14-0-2';
describe('Change from main tag to className tag', () => {
let tree: Tree;
beforeEach(async () => {
tree = createTreeWithEmptyWorkspace();
addProjectConfiguration(tree, 'products', {
root: 'apps/products',
sourceRoot: 'apps/products/src',
targets: {
start: {
executor: '@nrwl/react-native:start',
options: {
port: 8081,
},
},
},
});
});
it(`should udpate main file to registerComponent className`, async () => {
tree.write(
'apps/products/src/main.tsx',
`AppRegistry.registerComponent('main', () => App);`
);
await update(tree);
expect(tree.read('apps/products/src/main.tsx', 'utf-8')).toEqual(
`AppRegistry.registerComponent('Products', () => App);`
);
});
it(`should not udpate main file to registerComponent className if it does not exists`, async () => {
tree.write(
'apps/products/src/main.tsx',
`AppRegistry.registerComponent('otherTagName', () => App);`
);
await update(tree);
expect(tree.read('apps/products/src/main.tsx', 'utf-8')).toEqual(
`AppRegistry.registerComponent('otherTagName', () => App);`
);
});
});