diff --git a/modules/schematics/src/action/files/__name@dasherize@if-flat__/__name@dasherize__.actions.spec.ts.template b/modules/schematics/src/action/files/__name@dasherize@if-flat__/__name@dasherize__.actions.spec.ts.template index 95819022eb..0d100f89a5 100644 --- a/modules/schematics/src/action/files/__name@dasherize@if-flat__/__name@dasherize__.actions.spec.ts.template +++ b/modules/schematics/src/action/files/__name@dasherize@if-flat__/__name@dasherize__.actions.spec.ts.template @@ -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(); }); }); diff --git a/modules/schematics/src/action/index.spec.ts b/modules/schematics/src/action/index.spec.ts index 04414cdaef..226ea558b8 100644 --- a/modules/schematics/src/action/index.spec.ts +++ b/modules/schematics/src/action/index.spec.ts @@ -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', () => {