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:
Michal Gawrys 2024-06-04 21:28:21 +02:00 committed by GitHub
parent 9c2162fadc
commit c002b54fdc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -258,6 +258,38 @@ describe('updateImports', () => {
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 () => {
await libraryGenerator(tree, {
name: 'table',