Skip to content

Commit

Permalink
fix(schematics): fixed the schematics/action spec template (#2092)
Browse files Browse the repository at this point in the history
Closes #2082
  • Loading branch information
agugan authored and brandonroberts committed Sep 8, 2019
1 parent 0827916 commit ed3b1f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { <%= classify(name) %> } from './<%= dasherize(name) %>.actions';
import * as <%= classify(name) %>Actions from './<%= dasherize(name) %>.actions';

describe('<%= classify(name) %>', () => {
it('should create an instance', () => {
expect(new <%= classify(name) %>()).toBeTruthy();
expect(new <%= classify(name)%>Actions.Load<%= classify(name) %>s()).toBeTruthy();
});
});
10 changes: 10 additions & 0 deletions modules/schematics/src/action/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ describe('Action Schematic', () => {

expect(fileContent).toMatch(/export type FooActions = LoadFoos/);
});

it('should create spec class with right imports', () => {
const options = { ...defaultOptions, spec: true };
const tree = schematicRunner.runSchematic('action', options, appTree);
const fileContent = tree.readContent(
`${projectPath}/src/app/foo.actions.spec.ts`
);

expect(fileContent).toMatch(/expect\(new FooActions.LoadFoos\(\)\)/);
});
});

describe('action creators', () => {
Expand Down

0 comments on commit ed3b1f9

Please sign in to comment.