Skip to content

Commit

Permalink
refactor(schematics): Update container schematic tests to expect test…
Browse files Browse the repository at this point in the history
… file using MockStore
  • Loading branch information
ijz953 committed Jul 22, 2019
1 parent 999e71e commit 68facda
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions modules/schematics/src/container/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,21 @@ describe('Container Schematic', () => {
`${projectPath}/src/app/foo/foo.component.spec.ts`
);
expect(content).toMatch(
/import { Store, StoreModule } from '@ngrx\/store';/
/import { provideMockStore, MockStore } from '@ngrx\/store\/testing';/
);
});

it('should use the provideMockStore helper', async () => {
const options = { ...defaultOptions, spec: true };
const tree = await schematicRunner
.runSchematicAsync('container', options, appTree)
.toPromise();
const content = tree.readContent(
`${projectPath}/src/app/foo/foo.component.spec.ts`
);
expect(content).toMatch(/providers: \[ provideMockStore\(\) \]/);
});

it('should inject Store correctly', async () => {
const options = { ...defaultOptions, spec: true };
const tree = await schematicRunner
Expand All @@ -130,6 +141,6 @@ describe('Container Schematic', () => {
const content = tree.readContent(
`${projectPath}/src/app/foo/foo.component.spec.ts`
);
expect(content).toMatch(/store = TestBed\.get<Store>\(Store\);/);
expect(content).toMatch(/store = TestBed\.get\(Store\);/);
});
});

0 comments on commit 68facda

Please sign in to comment.