chore(misc): add test for move generator when there is a list export in the same file as path to update (#22070)
This commit is contained in:
parent
9c2162fadc
commit
c002b54fdc
@ -258,6 +258,38 @@ describe('updateImports', () => {
|
|||||||
expect(tree.read(importerFilePath, 'utf-8')).toMatchSnapshot();
|
expect(tree.read(importerFilePath, 'utf-8')).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not throw error on export list', async () => {
|
||||||
|
await libraryGenerator(tree, {
|
||||||
|
name: 'my-destination',
|
||||||
|
config: 'project',
|
||||||
|
projectNameAndRootFormat: 'as-provided',
|
||||||
|
});
|
||||||
|
await libraryGenerator(tree, {
|
||||||
|
name: 'my-source',
|
||||||
|
projectNameAndRootFormat: 'as-provided',
|
||||||
|
});
|
||||||
|
await libraryGenerator(tree, {
|
||||||
|
name: 'my-importer',
|
||||||
|
projectNameAndRootFormat: 'as-provided',
|
||||||
|
});
|
||||||
|
const importerFilePath = 'my-importer/src/importer.ts';
|
||||||
|
tree.write(
|
||||||
|
importerFilePath,
|
||||||
|
`
|
||||||
|
import { MyClass } from '@proj/my-source';
|
||||||
|
|
||||||
|
export { MyClass };
|
||||||
|
`
|
||||||
|
);
|
||||||
|
const projectConfig = readProjectConfiguration(tree, 'my-source');
|
||||||
|
|
||||||
|
const normalizedSchema = await normalizeSchema(tree, schema, projectConfig);
|
||||||
|
|
||||||
|
expect(() =>
|
||||||
|
updateImports(tree, normalizedSchema, projectConfig)
|
||||||
|
).not.toThrow();
|
||||||
|
});
|
||||||
|
|
||||||
it('should update require imports', async () => {
|
it('should update require imports', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
name: 'table',
|
name: 'table',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user