diff --git a/packages/schematics/angular/utility/ast-utils_spec.ts b/packages/schematics/angular/utility/ast-utils_spec.ts index 8e724c0721..6603d6c7fd 100644 --- a/packages/schematics/angular/utility/ast-utils_spec.ts +++ b/packages/schematics/angular/utility/ast-utils_spec.ts @@ -16,8 +16,8 @@ import { addExportToModule, addProviderToModule, addSymbolToNgModuleMetadata, - insertAfterLastOccurrence, findNodes, + insertAfterLastOccurrence, } from './ast-utils'; @@ -39,6 +39,7 @@ function applyChanges(path: string, content: string, changes: Change[]): string return getFileContent(tree, path); } +// tslint:disable-next-line:no-big-function describe('ast utils', () => { let modulePath: string; let moduleContent: string; @@ -209,20 +210,23 @@ describe('ast utils', () => { }); describe('insertAfterLastOccurrence', () => { - const filePath: string = './src/foo.ts'; + const filePath = './src/foo.ts'; it('should work for the default scenario', () => { const fileContent = `const arr = ['foo'];`; const source = getTsSource(filePath, fileContent); - const arrayNode = findNodes(source.getChildren().shift() as ts.Node, ts.SyntaxKind.ArrayLiteralExpression); + const arrayNode = findNodes( + source.getChildren().shift() as ts.Node, + ts.SyntaxKind.ArrayLiteralExpression, + ); const elements = (arrayNode.pop() as ts.ArrayLiteralExpression).elements; const change = insertAfterLastOccurrence( - elements as any as ts.Node[], + elements as unknown as ts.Node[], `, 'bar'`, filePath, elements.pos, - ts.SyntaxKind.StringLiteral + ts.SyntaxKind.StringLiteral, ); const output = applyChanges(filePath, fileContent, [change]); @@ -233,15 +237,18 @@ describe('ast utils', () => { it('should work without occurrences', () => { const fileContent = `const arr = [];`; const source = getTsSource(filePath, fileContent); - const arrayNode = findNodes(source.getChildren().shift() as ts.Node, ts.SyntaxKind.ArrayLiteralExpression); + const arrayNode = findNodes( + source.getChildren().shift() as ts.Node, + ts.SyntaxKind.ArrayLiteralExpression, + ); const elements = (arrayNode.pop() as ts.ArrayLiteralExpression).elements; const change = insertAfterLastOccurrence( - elements as any as ts.Node[], + elements as unknown as ts.Node[], `'bar'`, filePath, elements.pos, - ts.SyntaxKind.StringLiteral + ts.SyntaxKind.StringLiteral, ); const output = applyChanges(filePath, fileContent, [change]);