Skip to content

Commit

Permalink
test: verify handling of ExportDeclaration w/ moduleSpecifier and w/o…
Browse files Browse the repository at this point in the history
… moduleSpecifier
  • Loading branch information
dherges committed Apr 30, 2019
1 parent d9c2b5b commit 5f8b35b
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions packages/schematics/src/command-line/deps-calculator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,79 @@ describe('Calculates Dependencies Between Apps and Libs', () => {
});
});

it(`should handle an ExportDeclaration w/ moduleSpecifier and w/o moduleSpecifier`, () => {
const deps = dependencies(
'nrwl',
[
{
name: 'lib1Name',
root: 'libs/lib1',
files: ['lib1.ts'],
fileMTimes: {
'lib1.ts': 1
},
tags: [],
implicitDependencies: [],
architect: {},
type: ProjectType.lib
},
{
name: 'lib2Name',
root: 'libs/lib2',
files: ['lib2.ts'],
fileMTimes: {
'lib2.ts': 1
},
tags: [],
implicitDependencies: [],
architect: {},
type: ProjectType.lib
},
{
name: 'lib3Name',
root: 'libs/lib3',
files: ['lib3.ts'],
fileMTimes: {
'lib3.ts': 1
},
tags: [],
implicitDependencies: [],
architect: {},
type: ProjectType.lib
}
],
null,
file => {
switch (file) {
case 'lib1.ts':
return `
const FOO = 23;
export { FOO };
`;
case 'lib2.ts':
return `
export const BAR = 24;
`;
case 'lib3.ts':
return `
import { FOO } from '@nrwl/lib1';
export { FOO };
export { BAR } from '@nrwl/lib2';
`;
}
}
);

expect(deps).toEqual({
lib1Name: [],
lib2Name: [],
lib3Name: [
{ projectName: 'lib1Name', type: DependencyType.es6Import },
{ projectName: 'lib2Name', type: DependencyType.es6Import }
]
});
});

it('should calculate dependencies in .tsx files', () => {
const deps = dependencies(
'nrwl',
Expand Down

0 comments on commit 5f8b35b

Please sign in to comment.