From f543a3a4f1564b251a2c7ecf26407975ca0a765a Mon Sep 17 00:00:00 2001 From: splincode Date: Wed, 25 Dec 2024 13:14:52 +0300 Subject: [PATCH] chore(schematics): replace template line endings with platform specific --- .../ng-update/v4/tests/replace-crlf.spec.ts | 43 ++++++------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/projects/cdk/schematics/ng-update/v4/tests/replace-crlf.spec.ts b/projects/cdk/schematics/ng-update/v4/tests/replace-crlf.spec.ts index c5ea07fc67d25..7735bb35ca5ac 100644 --- a/projects/cdk/schematics/ng-update/v4/tests/replace-crlf.spec.ts +++ b/projects/cdk/schematics/ng-update/v4/tests/replace-crlf.spec.ts @@ -17,33 +17,18 @@ import {createAngularJson} from '../../../utils/create-angular-json'; const collectionPath = join(__dirname, '../../../migration.json'); const COMPONENT_BEFORE = `\r\n -@Component({ - standalone: true, - templateUrl: './test.template.html', -}) -export class Test {}\r\n`; +@Component({\r\n + standalone: true,\r\n + template: '',\r\n +})\r\n +export class Test {}`; const COMPONENT_AFTER = `${EOL} -@Component({ - standalone: true, - templateUrl: './test.template.html', -}) -export class Test {}${EOL}`; - -const TEMPLATE_BEFORE = '\r\n

Hello

\r\n'; - -const TEMPLATE_AFTER = `${EOL}

Hello

${EOL}`; - -const PACKAGE_BEFORE = - '{"dependencies": {"@angular/core": "~13.0.0", "@taiga-ui/addon-commerce": "~3.42.0"}}\r\n'; - -const PACKAGE_AFTER = `{ - "dependencies": { - "@angular/core": "~13.0.0", - "@taiga-ui/addon-commerce": "~3.42.0", - "@taiga-ui/event-plugins": "^4.2.3" - } -}${EOL}`; +@Component({${EOL} + standalone: true,${EOL} + template: '',${EOL} +})${EOL} +export class Test {}`; describe('ng-update', () => { let host: UnitTestTree; @@ -67,9 +52,7 @@ describe('ng-update', () => { host, ); - expect(tree.readContent('test/app/test.template.html')).toEqual(TEMPLATE_AFTER); expect(tree.readContent('test/app/test.component.ts')).toEqual(COMPONENT_AFTER); - expect(tree.readContent('package.json')).toEqual(PACKAGE_AFTER); }); afterEach(() => { @@ -80,6 +63,8 @@ describe('ng-update', () => { function createMainFiles(): void { createAngularJson(); createSourceFile('test/app/test.component.ts', COMPONENT_BEFORE); - createSourceFile('test/app/test.template.html', TEMPLATE_BEFORE); - createSourceFile('package.json', PACKAGE_BEFORE); + createSourceFile( + 'package.json', + '{"dependencies": {"@angular/core": "~13.0.0", "@taiga-ui/addon-commerce": "~3.42.0"}}', + ); }