Skip to content

Commit 9809d33

Browse files
authored
test(material/schematics): fix ng-add animations test (#24496)
As `addModuleImportToRootModule` is a void function, the test expectations in its result (value undefined) using '.not' would always be true. This change reads the file content and therefore gives the test its sense.
1 parent e1f4ba9 commit 9809d33

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/material/schematics/ng-add/index.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,15 @@ describe('ng-add schematic', () => {
239239
// Simulate the case where a developer uses `ng-add` on an Angular CLI project which already
240240
// explicitly uses the `BrowserAnimationsModule`. It would be wrong to forcibly change
241241
// to noop animations.
242-
const fileContent = addModuleImportToRootModule(
242+
addModuleImportToRootModule(
243243
appTree,
244244
'BrowserAnimationsModule',
245245
'@angular/platform-browser/animations',
246246
project,
247247
);
248248

249+
const fileContent = getFileContent(appTree, '/projects/material/src/app/app.module.ts');
250+
249251
expect(fileContent).not.toContain(
250252
'NoopAnimationsModule',
251253
'Expected the project app module to not import the "NoopAnimationsModule".',

0 commit comments

Comments
 (0)