From acb0e3eebbd828b8dbe07a366d60a1949e656d12 Mon Sep 17 00:00:00 2001 From: Badisi Date: Thu, 22 Feb 2024 09:39:53 +0100 Subject: [PATCH] fix(demo-app-web): fix lint --- package-lock.json | 157 +++++++++++++++++- package.json | 2 +- .../web/auth-js/src/app/app.element.spec.ts | 2 + .../web/auth-js/src/app/app.element.ts | 6 +- .../web/auth-js/src/app/app.settings.ts | 2 +- .../components/demo-app-debug.element.ts | 8 +- .../components/demo-app-header.element.ts | 12 +- .../components/demo-app-main.element.ts | 8 +- .../components/demo-app-playground.element.ts | 10 +- .../components/demo-app-settings.element.ts | 8 +- .../ngx-auth/src/app/app.component.spec.ts | 1 + .../web/ngx-auth/src/app/app.settings.ts | 2 +- .../web/ngx-auth/tsconfig.editor.json | 8 +- .../ngx-auth/schematics/install/index.spec.ts | 21 +-- 14 files changed, 198 insertions(+), 49 deletions(-) diff --git a/package-lock.json b/package-lock.json index b9ade3d..0f07f95 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,7 @@ "@nrwl/web": "15.8.6", "@nrwl/webpack": "15.8.6", "@nrwl/workspace": "15.8.6", - "@types/jest": "^29.5.12", + "@types/jest": "28.1.3", "@types/node": "^20.11.19", "cpy-cli": "^5.0.0", "esbuild": "^0.20.0", @@ -27089,13 +27089,158 @@ } }, "node_modules/@types/jest": { - "version": "29.5.12", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.12.tgz", - "integrity": "sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-28.1.3.tgz", + "integrity": "sha512-Tsbjk8Y2hkBaY/gJsataeb4q9Mubw9EOz7+4RjPkzD5KjTvHHs7cpws22InaoXxAVAhF5HfFbzJjo6oKWqSZLw==", + "dev": true, + "dependencies": { + "jest-matcher-utils": "^28.0.0", + "pretty-format": "^28.0.0" + } + }, + "node_modules/@types/jest/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@types/jest/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@types/jest/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@types/jest/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/@types/jest/node_modules/diff-sequences": { + "version": "28.1.1", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-28.1.1.tgz", + "integrity": "sha512-FU0iFaH/E23a+a718l8Qa/19bF9p06kgE0KipMOMadwa3SjnaElKzPaUC0vnibs6/B/9ni97s61mcejk8W1fQw==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/@types/jest/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@types/jest/node_modules/jest-diff": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-28.1.3.tgz", + "integrity": "sha512-8RqP1B/OXzjjTWkqMX67iqgwBVJRgCyKD3L9nq+6ZqJMdvjE8RgHktqZ6jNrkdMT+dJuYNI3rhQpxaz7drJHfw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^28.1.1", + "jest-get-type": "^28.0.2", + "pretty-format": "^28.1.3" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/@types/jest/node_modules/jest-get-type": { + "version": "28.0.2", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.2.tgz", + "integrity": "sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/@types/jest/node_modules/jest-matcher-utils": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-28.1.3.tgz", + "integrity": "sha512-kQeJ7qHemKfbzKoGjHHrRKH6atgxMk8Enkk2iPQ3XwO6oE/KYD8lMYOziCkeSB9G4adPM4nR1DE8Tf5JeWH6Bw==", "dev": true, "dependencies": { - "expect": "^29.0.0", - "pretty-format": "^29.0.0" + "chalk": "^4.0.0", + "jest-diff": "^28.1.3", + "jest-get-type": "^28.0.2", + "pretty-format": "^28.1.3" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/@types/jest/node_modules/pretty-format": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.3.tgz", + "integrity": "sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q==", + "dev": true, + "dependencies": { + "@jest/schemas": "^28.1.3", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/@types/jest/node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@types/jest/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, "node_modules/@types/jsdom": { diff --git a/package.json b/package.json index 967e8c7..ecaa9ca 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "@nrwl/web": "15.8.6", "@nrwl/webpack": "15.8.6", "@nrwl/workspace": "15.8.6", - "@types/jest": "^29.5.12", + "@types/jest": "28.1.3", "@types/node": "^20.11.19", "cpy-cli": "^5.0.0", "esbuild": "^0.20.0", diff --git a/projects/demo-app/web/auth-js/src/app/app.element.spec.ts b/projects/demo-app/web/auth-js/src/app/app.element.spec.ts index 600fbbe..9077d72 100644 --- a/projects/demo-app/web/auth-js/src/app/app.element.spec.ts +++ b/projects/demo-app/web/auth-js/src/app/app.element.spec.ts @@ -1,3 +1,5 @@ +import { describe, expect, it } from '@jest/globals'; + import { AppElement } from './app.element'; describe('AppElement', () => { diff --git a/projects/demo-app/web/auth-js/src/app/app.element.ts b/projects/demo-app/web/auth-js/src/app/app.element.ts index d6fe22a..a3a6f97 100644 --- a/projects/demo-app/web/auth-js/src/app/app.element.ts +++ b/projects/demo-app/web/auth-js/src/app/app.element.ts @@ -25,9 +25,9 @@ export class AppElement extends HTMLElement { } public connectedCallback(): void { - this.demoAppMainEl = this.shadowRoot?.querySelector('demo-app-main') as DemoAppMainElement; - this.demoAppPlaygroundEl = this.shadowRoot?.querySelector('demo-app-playground') as DemoAppPlaygroundElement; - this.demoAppDebugEl = this.shadowRoot?.querySelector('demo-app-debug') as DemoAppDebugElement; + this.demoAppMainEl = this.shadowRoot!.querySelector('demo-app-main')!; + this.demoAppPlaygroundEl = this.shadowRoot!.querySelector('demo-app-playground')!; + this.demoAppDebugEl = this.shadowRoot!.querySelector('demo-app-debug')!; this.listenForHeaderEvents(); this.listenForPlaygroundEvents(); diff --git a/projects/demo-app/web/auth-js/src/app/app.settings.ts b/projects/demo-app/web/auth-js/src/app/app.settings.ts index 1a3f784..c36de2c 100644 --- a/projects/demo-app/web/auth-js/src/app/app.settings.ts +++ b/projects/demo-app/web/auth-js/src/app/app.settings.ts @@ -4,7 +4,7 @@ import pkgJson from 'projects/auth-js/package.json'; import { environment } from '../environments/environment'; -export const appSettings: DemoAppSettings = new DemoAppSettings( +export const appSettings = new DemoAppSettings( // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any `auth-js:${(pkgJson as any).version as string}:demo-app:settings`, { showTip: true, diff --git a/projects/demo-app/web/common/components/demo-app-debug.element.ts b/projects/demo-app/web/common/components/demo-app-debug.element.ts index 6855a56..1e6dde4 100644 --- a/projects/demo-app/web/common/components/demo-app-debug.element.ts +++ b/projects/demo-app/web/common/components/demo-app-debug.element.ts @@ -94,7 +94,7 @@ export class DemoAppDebugElement extends HTMLElement { } } - public set userSession(value: unknown | undefined) { + public set userSession(value: unknown) { this.update('#userSession', prettyPrint(value, ['expires_at'])); } @@ -102,7 +102,7 @@ export class DemoAppDebugElement extends HTMLElement { this.update('#accessToken', value); } - public set accessTokenDecoded(value: unknown | undefined) { + public set accessTokenDecoded(value: unknown) { const text = (typeof value !== 'string') ? prettyPrint(value, ['exp', 'iat', 'auth_time']) : '(no decoded info as it is not a JWT token)'; this.update('#accessTokenDecoded', text); @@ -112,11 +112,11 @@ export class DemoAppDebugElement extends HTMLElement { this.update('#idToken', value); } - public set idTokenDecoded(value: unknown | undefined) { + public set idTokenDecoded(value: unknown) { this.update('#idTokenDecoded', prettyPrint(value, ['exp', 'iat', 'auth_time'])); } - public set userProfile(value: unknown | undefined) { + public set userProfile(value: unknown) { this.update('#userProfile', prettyPrint(value)); } diff --git a/projects/demo-app/web/common/components/demo-app-header.element.ts b/projects/demo-app/web/common/components/demo-app-header.element.ts index 0d8b8ba..2063028 100644 --- a/projects/demo-app/web/common/components/demo-app-header.element.ts +++ b/projects/demo-app/web/common/components/demo-app-header.element.ts @@ -201,12 +201,12 @@ export class DemoAppHeaderElement extends HTMLElement { this.attachShadow({ mode: 'open' }); this.shadowRoot?.appendChild(document.importNode(template.content, true)); - this.implSelectEl = this.shadowRoot?.querySelector('#implementation-select') as HTMLSelectElement; - this.statusEl = this.shadowRoot?.querySelector('.status') as HTMLElement; - this.versionEl = this.shadowRoot?.querySelector('.version') as HTMLElement; - this.loginButtonEl = this.shadowRoot?.querySelector('#login-button') as HTMLElement; - this.logoutButtonEl = this.shadowRoot?.querySelector('#logout-button') as HTMLElement; - this.silentRenewButtonEl = this.shadowRoot?.querySelector('#silent-renew-button') as HTMLElement; + this.implSelectEl = this.shadowRoot!.querySelector('#implementation-select')!; + this.statusEl = this.shadowRoot!.querySelector('.status')!; + this.versionEl = this.shadowRoot!.querySelector('.version')!; + this.loginButtonEl = this.shadowRoot!.querySelector('#login-button')!; + this.logoutButtonEl = this.shadowRoot!.querySelector('#logout-button')!; + this.silentRenewButtonEl = this.shadowRoot!.querySelector('#silent-renew-button')!; } public set isRenewing(value: boolean) { diff --git a/projects/demo-app/web/common/components/demo-app-main.element.ts b/projects/demo-app/web/common/components/demo-app-main.element.ts index cafbdd5..5c8fcce 100644 --- a/projects/demo-app/web/common/components/demo-app-main.element.ts +++ b/projects/demo-app/web/common/components/demo-app-main.element.ts @@ -79,8 +79,8 @@ export class DemoAppMainElement extends HTMLElement { this.attachShadow({ mode: 'open' }); this.shadowRoot?.appendChild(document.importNode(template.content, true)); - this.tabsContentEl = this.shadowRoot?.querySelector('.tabs-content') as HTMLElement; - this.demoAppHeaderEl = this.shadowRoot?.querySelector('demo-app-header') as DemoAppHeaderElement; + this.tabsContentEl = this.shadowRoot!.querySelector('.tabs-content')!; + this.demoAppHeaderEl = this.shadowRoot!.querySelector('demo-app-header')!; } public set isRenewing(value: boolean) { @@ -103,8 +103,8 @@ export class DemoAppMainElement extends HTMLElement { // --- HELPER(s) --- private drawTabs(): void { - const viewsEl = this.shadowRoot?.querySelector('#views') as HTMLSlotElement; - const tabsEl = this.shadowRoot?.querySelector('#tabs') as HTMLElement; + const viewsEl = this.shadowRoot!.querySelector('#views')!; + const tabsEl = this.shadowRoot!.querySelector('#tabs')!; if (viewsEl && tabsEl) { this.views = viewsEl.assignedElements() as HTMLElement[]; this.views.forEach((view, index) => { diff --git a/projects/demo-app/web/common/components/demo-app-playground.element.ts b/projects/demo-app/web/common/components/demo-app-playground.element.ts index ec70259..b76374e 100644 --- a/projects/demo-app/web/common/components/demo-app-playground.element.ts +++ b/projects/demo-app/web/common/components/demo-app-playground.element.ts @@ -67,10 +67,10 @@ export class DemoAppPlaygroundElement extends HTMLElement { this.attachShadow({ mode: 'open' }); this.shadowRoot?.appendChild(document.importNode(template.content, true)); - this.apiStatusEl = this.shadowRoot?.querySelector('#api-status') as HTMLElement; - this.apiResponseEl = this.shadowRoot?.querySelector('#api-response') as HTMLElement; - this.apiUrlEl = this.shadowRoot?.querySelector('#api-url-input') as HTMLInputElement; - this.apiHeadersEl = this.shadowRoot?.querySelector('#api-headers-input') as HTMLInputElement; + this.apiStatusEl = this.shadowRoot!.querySelector('#api-status')!; + this.apiResponseEl = this.shadowRoot!.querySelector('#api-response')!; + this.apiUrlEl = this.shadowRoot!.querySelector('#api-url-input')!; + this.apiHeadersEl = this.shadowRoot!.querySelector('#api-headers-input')!; } public connectedCallback(): void { @@ -113,7 +113,7 @@ export class DemoAppPlaygroundElement extends HTMLElement { // --- API(s) --- - public setApiStatus(data: unknown | Error, isError: boolean): void { + public setApiStatus(data: unknown, isError: boolean): void { this.apiStatusEl.classList.remove(isError ? 'success' : 'error'); this.apiStatusEl.classList.add(isError ? 'error' : 'success'); this.apiResponseEl.innerHTML = prettyPrint(data); diff --git a/projects/demo-app/web/common/components/demo-app-settings.element.ts b/projects/demo-app/web/common/components/demo-app-settings.element.ts index 24730b2..44b07a8 100644 --- a/projects/demo-app/web/common/components/demo-app-settings.element.ts +++ b/projects/demo-app/web/common/components/demo-app-settings.element.ts @@ -161,10 +161,10 @@ export class DemoAppSettingsElement extends HTMLElement { } public connectedCallback(): void { - this.formEl = this.shadowRoot?.querySelector('form') as HTMLFormElement; - this.formContentEl = this.shadowRoot?.querySelector('.form-content') as HTMLElement; - this.selectEl = this.shadowRoot?.querySelector('#settings-select') as HTMLSelectElement; - this.settingsNameEl = this.shadowRoot?.querySelector('#settingsName') as HTMLInputElement; + this.formEl = this.shadowRoot!.querySelector('form')!; + this.formContentEl = this.shadowRoot!.querySelector('.form-content')!; + this.selectEl = this.shadowRoot!.querySelector('#settings-select')!; + this.settingsNameEl = this.shadowRoot!.querySelector('#settingsName')!; // Form events const inputCb = (e: Event): void => { diff --git a/projects/demo-app/web/ngx-auth/src/app/app.component.spec.ts b/projects/demo-app/web/ngx-auth/src/app/app.component.spec.ts index beed57a..5248396 100644 --- a/projects/demo-app/web/ngx-auth/src/app/app.component.spec.ts +++ b/projects/demo-app/web/ngx-auth/src/app/app.component.spec.ts @@ -1,5 +1,6 @@ import { TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; +import { describe, expect, it } from '@jest/globals'; import { AppComponent } from './app.component'; diff --git a/projects/demo-app/web/ngx-auth/src/app/app.settings.ts b/projects/demo-app/web/ngx-auth/src/app/app.settings.ts index 23c8e5e..6bd3a4f 100644 --- a/projects/demo-app/web/ngx-auth/src/app/app.settings.ts +++ b/projects/demo-app/web/ngx-auth/src/app/app.settings.ts @@ -4,7 +4,7 @@ import pkgJson from 'projects/ngx-auth/package.json'; import { environment } from '../environments/environment'; -export const appSettings: DemoAppSettings = new DemoAppSettings( +export const appSettings = new DemoAppSettings( // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any `ngx-auth:${(pkgJson as any).version as string}:demo-app:settings`, { showTip: true, diff --git a/projects/demo-app/web/ngx-auth/tsconfig.editor.json b/projects/demo-app/web/ngx-auth/tsconfig.editor.json index ecb3eb2..d30504d 100644 --- a/projects/demo-app/web/ngx-auth/tsconfig.editor.json +++ b/projects/demo-app/web/ngx-auth/tsconfig.editor.json @@ -1,12 +1,12 @@ { "extends": "./tsconfig.json", - "include": [ - "**/*.ts" - ], "compilerOptions": { "types": [ "jest", "node" ] - } + }, + "include": [ + "**/*.ts" + ] } diff --git a/projects/ngx-auth/schematics/install/index.spec.ts b/projects/ngx-auth/schematics/install/index.spec.ts index 05df68a..ed04e91 100644 --- a/projects/ngx-auth/schematics/install/index.spec.ts +++ b/projects/ngx-auth/schematics/install/index.spec.ts @@ -3,6 +3,7 @@ import { Tree } from '@angular-devkit/schematics'; import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'; import { disable as disableColors } from '@colors/colors'; +import { describe, expect, it } from '@jest/globals'; import { Schema as ApplicationOptions, Style } from '@schematics/angular/application/schema'; import { Schema as WorkspaceOptions } from '@schematics/angular/workspace/schema'; import { join } from 'path'; @@ -84,7 +85,7 @@ describe('Test - install schematic', () => { it('should not create any new files', async () => { tree = await runner.runSchematicAsync('install', schematicOptions, tree).toPromise(); - void expect(tree.files.length).toEqual(nbFiles); + expect(tree.files.length).toEqual(nbFiles); }); it('should not create duplicates when running twice', async () => { @@ -93,23 +94,23 @@ describe('Test - install schematic', () => { const angularJsonPath = 'angular.json'; const angularJsonContent = tree.read(angularJsonPath)?.toString('utf-8') || ''; - void expect(occurrences(angularJsonContent, 'crypto-js')).toEqual(1); - void expect(occurrences(angularJsonContent, 'node_modules/@badisi/ngx-auth/oidc/assets')).toEqual(2); + expect(occurrences(angularJsonContent, 'crypto-js')).toEqual(1); + expect(occurrences(angularJsonContent, 'node_modules/@badisi/ngx-auth/oidc/assets')).toEqual(2); const mainTsPath = '/projects/app-test/src/main.ts'; const mainTsContent = tree.read(mainTsPath)?.toString('utf-8') || ''; - void expect(occurrences(mainTsContent, '@badisi/ngx-auth')).toEqual(1); - void expect(occurrences(mainTsContent, 'initAuth')).toEqual(2); + expect(occurrences(mainTsContent, '@badisi/ngx-auth')).toEqual(1); + expect(occurrences(mainTsContent, 'initAuth')).toEqual(2); const appModuleTsPath = '/projects/app-test/src/app/app.module.ts'; const appModuleTsContent = tree.read(appModuleTsPath)?.toString('utf-8') || ''; - void expect(occurrences(appModuleTsContent, '@badisi/ngx-auth')).toEqual(1); - void expect(occurrences(appModuleTsContent, 'AuthModule')).toEqual(2); + expect(occurrences(appModuleTsContent, '@badisi/ngx-auth')).toEqual(1); + expect(occurrences(appModuleTsContent, 'AuthModule')).toEqual(2); }); it('should display an action message', async () => { tree = await runner.runSchematicAsync('install', schematicOptions, tree).toPromise(); - void expect(logs).toContainEqual(expect.objectContaining({ + expect(logs).toContainEqual(expect.objectContaining({ name: 'install', level: 'info', message: '\r> ACTION Have a look at main.ts file and update the auth configuration according to your needs.\n' @@ -122,12 +123,12 @@ describe('Test - install schematic', () => { tree.overwrite(mainTsPath, mainTsContent.replace('bootstrapModule', 'bootstrapModuleERROR')); tree = await runner.runSchematicAsync('install', schematicOptions, tree).toPromise(); - void expect(logs).toContainEqual(expect.objectContaining({ + expect(logs).toContainEqual(expect.objectContaining({ name: 'install', level: 'info', message: '\r> ERROR There were some conflict during the installation, please have a look at main.ts file and resolve it.\n' })); - void expect(logs).toContainEqual(expect.objectContaining({ + expect(logs).toContainEqual(expect.objectContaining({ name: 'install', level: 'info', message: '\r> ACTION Have a look at main.ts file and update the auth configuration according to your needs.\n'