Skip to content

Commit

Permalink
chore(misc): add test for move generator when there is a list export …
Browse files Browse the repository at this point in the history
…in the same file as path to update (#22070)
  • Loading branch information
mgawrys-recruitee authored Jun 4, 2024
1 parent 9c2162f commit c002b54
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions packages/workspace/src/generators/move/lib/update-imports.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit c002b54

Please sign in to comment.