diff --git a/projects/ngx-meta/schematics/ng-add/index.spec.ts b/projects/ngx-meta/schematics/ng-add/index.spec.ts index 33230f41..e9bd1554 100644 --- a/projects/ngx-meta/schematics/ng-add/index.spec.ts +++ b/projects/ngx-meta/schematics/ng-add/index.spec.ts @@ -16,10 +16,9 @@ describe('ng-add schematic', () => { let runner: SchematicTestRunner let appTree: Tree - const defaultOptions: NgAddSchema = { + const defaultOptions = { project: 'test', - routing: false, - } + } satisfies Partial beforeEach(async () => { runner = new SchematicTestRunner( @@ -51,7 +50,7 @@ describe('ng-add schematic', () => { let tree: Tree beforeEach(async () => { - tree = await runner.runSchematic( + tree = await runner.runSchematic>( SCHEMATIC_NAME, defaultOptions, appTree, @@ -61,20 +60,22 @@ describe('ng-add schematic', () => { shouldAddRootProvider(CORE_PROVIDER, () => tree, standalone) shouldNotAddRootProvider(ROUTING_PROVIDER, () => tree, standalone) }) + ;[true, false].forEach((routing) => { + describe(`when routing option is ${routing}`, () => { + let tree: Tree - describe('when routing option is true', () => { - const routing = true - let tree: Tree + beforeEach(async () => { + tree = await runner.runSchematic>( + SCHEMATIC_NAME, + { ...defaultOptions, routing }, + appTree, + ) + }) - beforeEach(async () => { - tree = await runner.runSchematic( - SCHEMATIC_NAME, - { ...defaultOptions, routing }, - appTree, - ) + routing + ? shouldAddRootProvider(ROUTING_PROVIDER, () => tree, standalone) + : shouldNotAddRootProvider(ROUTING_PROVIDER, () => tree, standalone) }) - - shouldAddRootProvider(ROUTING_PROVIDER, () => tree, standalone) }) }) })