@tech4good/angular-schematics 20.3.1 → 21.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/publish-npm/SKILL.md +1 -1
- package/.agents/skills/publish-npm/eval.yaml +15 -0
- package/.agents/skills/publish-npm/fixtures/package-v21.json.template +8 -0
- package/.t4g/agent-memory.db +0 -0
- package/CHANGELOG.md +62 -0
- package/contributing-docs/commit-message.md +3 -6
- package/package.json +5 -5
- package/src/collection.json +8 -0
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.ts.template +1 -3
- package/src/component/index_spec.js +57 -4
- package/src/component/index_spec.js.map +1 -1
- package/src/entity/index.js +7 -1
- package/src/entity/index.js.map +1 -1
- package/src/entity/index_spec.js +108 -4
- package/src/entity/index_spec.js.map +1 -1
- package/src/guard/files/__name@dasherize__.guard.spec.ts.template +45 -0
- package/src/guard/files/__name@dasherize__.guard.ts.template +32 -0
- package/src/guard/index.d.ts +2 -0
- package/src/guard/index.js +38 -0
- package/src/guard/index.js.map +1 -0
- package/src/guard/index_spec.d.ts +1 -0
- package/src/guard/index_spec.js +64 -0
- package/src/guard/index_spec.js.map +1 -0
- package/src/guard/schema.json +46 -0
- package/src/ng-add/files/.firebaserc.template +3 -2
- package/src/ng-add/files/.github/workflows/angular-github-ci.yml.template +105 -39
- package/src/ng-add/files/.gitignore.template +1 -2
- package/src/ng-add/files/angular.json.template +1 -5
- package/src/ng-add/files/docs-infra/infrastructure-guide.md.template +390 -0
- package/src/ng-add/files/docs-infra/load-system-architecture.md.template +166 -0
- package/src/ng-add/files/docs-infra/querying-strategy.md.template +157 -0
- package/src/ng-add/files/docs-infra/stream-system-architecture.md.template +283 -0
- package/src/ng-add/files/eslint.config.js.template +4 -1
- package/src/ng-add/files/firebase.json.template +37 -0
- package/src/ng-add/files/firestore.rules.spec.ts.template +221 -0
- package/src/ng-add/files/firestore.rules.template +67 -0
- package/src/ng-add/files/jest.config.ts.template +6 -1
- package/src/ng-add/files/package.json.template +41 -31
- package/src/ng-add/files/setup-jest.ts.template +13 -5
- package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.spec.ts.template +76 -12
- package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.ts.template +1 -3
- package/src/ng-add/files/src/app/admin/admin-panel/admin-settings/admin-settings.component.spec.ts.template +90 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-settings/admin-settings.component.ts.template +1 -1
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-count-pill/admin-count-pill.component.spec.ts.template +12 -17
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-count-pill/admin-count-pill.component.ts.template +2 -4
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-user-counts.component.spec.ts.template +40 -19
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-user-counts.component.ts.template +3 -5
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.html.template +2 -2
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.spec.ts.template +108 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.ts.template +11 -11
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.html.template +6 -2
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.spec.ts.template +136 -19
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.ts.template +8 -5
- package/src/ng-add/files/src/app/app.component.html.template +1 -1
- package/src/ng-add/files/src/app/app.component.scss.template +10 -0
- package/src/ng-add/files/src/app/app.component.ts.template +1 -1
- package/src/ng-add/files/src/app/app.config.ts.template +11 -11
- package/src/ng-add/files/src/app/auth-routing.spec.ts.template +101 -0
- package/src/ng-add/files/src/app/core/analytics/log.service.ts.template +5 -8
- package/src/ng-add/files/src/app/core/analytics/time-analytics.service.spec.ts.template +140 -0
- package/src/ng-add/files/src/app/core/analytics/time-analytics.service.ts.template +25 -7
- package/src/ng-add/files/src/app/core/auth/guards/redirect-if-authenticated.guard.ts.template +1 -1
- package/src/ng-add/files/src/app/core/auth/guards/require-admin.guard.ts.template +1 -1
- package/src/ng-add/files/src/app/core/auth/guards/require-auth-and-consent.guard.ts.template +1 -1
- package/src/ng-add/files/src/app/core/auth/guards/require-auth.guard.ts.template +1 -1
- package/src/ng-add/files/src/app/core/firebase/cached-listeners.service.ts.template +229 -14
- package/src/ng-add/files/src/app/core/firebase/database.service.ts.template +1 -1
- package/src/ng-add/files/src/app/core/firebase/firebase.mock.service.ts.template +34 -9
- package/src/ng-add/files/src/app/core/firebase/firebase.service.ts.template +4 -4
- package/src/ng-add/files/src/app/core/firebase/query-logger.ts.template +11 -0
- package/src/ng-add/files/src/app/core/firebase/simulate-load.spec.ts.template +104 -0
- package/src/ng-add/files/src/app/core/firebase/simulate-stream.spec.ts.template +127 -0
- package/src/ng-add/files/src/app/core/firebase/simulation.mock.ts.template +38 -0
- package/src/ng-add/files/src/app/core/firebase/stream-multiplexer.ts.template +443 -0
- package/src/ng-add/files/src/app/core/store/app.store.spec.ts.template +920 -0
- package/src/ng-add/files/src/app/core/store/app.store.ts.template +303 -137
- package/src/ng-add/files/src/app/core/store/auth/auth.mock.ts.template +65 -23
- package/src/ng-add/files/src/app/core/store/auth/auth.store.ts.template +68 -67
- package/src/ng-add/files/src/app/core/store/user/user.mock.ts.template +46 -0
- package/src/ng-add/files/src/app/core/store/user-context/user-context.mock.ts.template +17 -0
- package/src/ng-add/files/src/app/core/testing/test-utils.ts.template +26 -0
- package/src/ng-add/files/src/app/first-time/consent/consent.component.html.template +3 -3
- package/src/ng-add/files/src/app/first-time/consent/consent.component.spec.ts.template +89 -13
- package/src/ng-add/files/src/app/first-time/consent/consent.component.ts.template +46 -17
- package/src/ng-add/files/src/app/first-time/consent/consent.guard.ts.template +1 -1
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.html.template +5 -63
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.scss.template +1 -94
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.spec.ts.template +150 -14
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.ts.template +15 -42
- package/src/ng-add/files/src/app/first-time/early-access/early-access.guard.ts.template +2 -2
- package/src/ng-add/files/src/app/first-time/early-access/early-access.model.ts.template +5 -0
- package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.html.template +42 -0
- package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.scss.template +96 -0
- package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.spec.ts.template +37 -0
- package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.ts.template +63 -0
- package/src/ng-add/files/src/app/first-time/early-access/waitlist-view/waitlist-view.component.html.template +16 -0
- package/src/ng-add/files/src/app/first-time/early-access/waitlist-view/waitlist-view.component.scss.template +7 -0
- package/src/ng-add/files/src/app/first-time/early-access/waitlist-view/waitlist-view.component.spec.ts.template +41 -0
- package/src/ng-add/files/src/app/first-time/early-access/waitlist-view/waitlist-view.component.ts.template +26 -0
- package/src/ng-add/files/src/app/first-time/first-time-routing.spec.ts.template +123 -0
- package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.html.template +11 -4
- package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.scss.template +17 -4
- package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.ts.template +5 -5
- package/src/ng-add/files/src/app/first-time/landing/landing.component.html.template +1 -1
- package/src/ng-add/files/src/app/first-time/landing/landing.component.scss.template +0 -1
- package/src/ng-add/files/src/app/first-time/landing/landing.component.spec.ts.template +25 -17
- package/src/ng-add/files/src/app/first-time/landing/landing.component.ts.template +4 -12
- package/src/ng-add/files/src/app/first-time/landing/rotating-quotes/rotating-quotes.component.ts.template +1 -1
- package/src/ng-add/files/src/app/first-time/login/login.component.spec.ts.template +36 -16
- package/src/ng-add/files/src/app/first-time/login/login.component.ts.template +1 -1
- package/src/ng-add/files/src/app/first-time/onboarding/onboarding.component.spec.ts.template +11 -15
- package/src/ng-add/files/src/app/first-time/onboarding/onboarding.component.ts.template +1 -3
- package/src/ng-add/files/src/app/main/home/home.component.ts.template +1 -3
- package/src/ng-add/files/src/app/shared/dev-status-bar/dev-status-bar.component.spec.ts.template +98 -0
- package/src/ng-add/files/src/app/shared/dev-status-bar/dev-status-bar.component.ts.template +9 -3
- package/src/ng-add/files/src/app/shared/hint-visibility/hint-visibility.directive.spec.ts.template +164 -0
- package/src/ng-add/files/src/app/shared/hint-visibility/hint-visibility.directive.ts.template +20 -18
- package/src/ng-add/files/src/app/shared/navbar/navbar.component.spec.ts.template +38 -17
- package/src/ng-add/files/src/app/shared/navbar/navbar.component.ts.template +1 -1
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.html.template +1 -1
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.spec.ts.template +49 -10
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.ts.template +5 -5
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.service.spec.ts.template +86 -0
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.service.ts.template +11 -9
- package/src/ng-add/files/src/environments/environment.prod.ts.template +1 -0
- package/src/ng-add/files/src/environments/environment.test.ts.template +1 -0
- package/src/ng-add/files/src/environments/environment.ts.template +2 -8
- package/src/ng-add/files/src/styles.scss.template +29 -1
- package/src/ng-add/files/tsconfig.app.json.template +6 -6
- package/src/ng-add/files/tsconfig.json.template +13 -8
- package/src/ng-add/files/tsconfig.spec.json.template +6 -5
- package/src/ng-add/index.js +19 -1
- package/src/ng-add/index.js.map +1 -1
- package/src/component/files/__name@dasherize__/__name@dasherize__.animations.ts.template +0 -4
- package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.animations.ts.template +0 -4
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-count-pill/admin-count-pill.animations.ts.template +0 -4
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-user-counts.animations.ts.template +0 -4
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.animations.ts.template +0 -4
- package/src/ng-add/files/src/app/first-time/consent/consent.animations.ts.template +0 -4
- package/src/ng-add/files/src/app/first-time/early-access/early-access.animations.ts.template +0 -10
- package/src/ng-add/files/src/app/first-time/landing/hero/hero.animations.ts.template +0 -15
- package/src/ng-add/files/src/app/first-time/landing/landing.animations.ts.template +0 -4
- package/src/ng-add/files/src/app/first-time/onboarding/onboarding.animations.ts.template +0 -4
- package/src/ng-add/files/src/app/main/home/home.animations.ts.template +0 -4
package/src/ng-add/files/src/app/first-time/onboarding/onboarding.component.spec.ts.template
CHANGED
|
@@ -1,37 +1,33 @@
|
|
|
1
1
|
import { render } from '@testing-library/angular';
|
|
2
|
-
import
|
|
2
|
+
import { Provider } from '@angular/core';
|
|
3
3
|
|
|
4
4
|
import { OnboardingComponent } from './onboarding.component';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
5
|
+
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
6
|
+
import { AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
|
|
8
7
|
import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
8
|
+
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
9
9
|
|
|
10
|
-
/** Sets up the testing environment for OnboardingComponent using render
|
|
11
|
-
async function setup() {
|
|
12
|
-
const user = userEvent.setup();
|
|
13
|
-
const checkedSpy = jest.fn();
|
|
14
|
-
|
|
10
|
+
/** Sets up the testing environment for OnboardingComponent using render. */
|
|
11
|
+
async function setup(providers: Provider[] = []) {
|
|
15
12
|
const view = await render(OnboardingComponent, {
|
|
16
13
|
imports: [],
|
|
17
14
|
providers: [
|
|
18
|
-
{ provide:
|
|
15
|
+
{ provide: AuthStore, useClass: AuthLoggedInMockDB },
|
|
19
16
|
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
17
|
+
...providers,
|
|
20
18
|
],
|
|
21
|
-
componentInputs: {},
|
|
22
|
-
on: {},
|
|
23
19
|
});
|
|
24
20
|
|
|
25
21
|
return {
|
|
26
|
-
user,
|
|
27
22
|
fixture: view.fixture,
|
|
28
|
-
rerender: () => view.rerender(), // add component inputs if needed
|
|
29
23
|
};
|
|
30
24
|
}
|
|
31
25
|
|
|
32
26
|
describe('OnboardingComponent', () => {
|
|
33
|
-
it('should create', async () => {
|
|
27
|
+
it('should create and render empty container', async () => {
|
|
34
28
|
const { fixture } = await setup();
|
|
35
29
|
expect(fixture.componentInstance).toBeTruthy();
|
|
30
|
+
const container = fixture.nativeElement.querySelector('.onboarding-container');
|
|
31
|
+
expect(container).toBeTruthy();
|
|
36
32
|
});
|
|
37
33
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Component, OnInit, ChangeDetectionStrategy, input, output, inject, WritableSignal, Signal, signal, computed, Inject, Injector } from '@angular/core';
|
|
2
|
-
import { OnboardingAnimations } from './onboarding.animations';
|
|
3
2
|
import { User } from 'src/app/core/store/user/user.model';
|
|
4
3
|
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
5
4
|
import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
@@ -7,9 +6,8 @@ import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch
|
|
|
7
6
|
@Component({
|
|
8
7
|
selector: 'app-onboarding',
|
|
9
8
|
templateUrl: './onboarding.component.html',
|
|
10
|
-
|
|
9
|
+
styleUrl: './onboarding.component.scss',
|
|
11
10
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
-
animations: OnboardingAnimations,
|
|
13
11
|
})
|
|
14
12
|
export class OnboardingComponent implements OnInit {
|
|
15
13
|
authStore = inject(AuthStore);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Component, OnInit, ChangeDetectionStrategy, input, output, inject, WritableSignal, Signal, signal, computed, Inject, Injector } from '@angular/core';
|
|
2
|
-
import { HomeAnimations } from './home.animations';
|
|
3
2
|
import { User } from 'src/app/core/store/user/user.model';
|
|
4
3
|
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
5
4
|
import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
@@ -8,9 +7,8 @@ import { NavbarComponent } from 'src/app/shared/navbar/navbar.component';
|
|
|
8
7
|
@Component({
|
|
9
8
|
selector: 'app-home',
|
|
10
9
|
templateUrl: './home.component.html',
|
|
11
|
-
|
|
10
|
+
styleUrl: './home.component.scss',
|
|
12
11
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
13
|
-
animations: HomeAnimations,
|
|
14
12
|
imports: [
|
|
15
13
|
NavbarComponent,
|
|
16
14
|
]
|
package/src/ng-add/files/src/app/shared/dev-status-bar/dev-status-bar.component.spec.ts.template
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/angular';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { Router } from '@angular/router';
|
|
4
|
+
import { RouterTestingModule } from '@angular/router/testing';
|
|
5
|
+
import { Provider } from '@angular/core';
|
|
6
|
+
import { DevStatusBarComponent, LOCATION } from './dev-status-bar.component';
|
|
7
|
+
import { AuthStore } from '../../core/store/auth/auth.store';
|
|
8
|
+
import { AuthLoggedInMockDB } from '../../core/store/auth/auth.mock';
|
|
9
|
+
import { USER_DB } from '../../core/store/user/user.mock';
|
|
10
|
+
import { environment } from '../../../environments/environment';
|
|
11
|
+
|
|
12
|
+
/** Sets up the testing environment for DevStatusBarComponent. */
|
|
13
|
+
async function setup(providers: Provider[] = []) {
|
|
14
|
+
const user = userEvent.setup();
|
|
15
|
+
|
|
16
|
+
const view = await render(DevStatusBarComponent, {
|
|
17
|
+
imports: [RouterTestingModule.withRoutes([{ path: 'test-url', component: DevStatusBarComponent }])],
|
|
18
|
+
providers: [
|
|
19
|
+
{ provide: AuthStore, useClass: AuthLoggedInMockDB },
|
|
20
|
+
...providers,
|
|
21
|
+
],
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
user,
|
|
26
|
+
fixture: view.fixture,
|
|
27
|
+
router: view.fixture.debugElement.injector.get(Router),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
describe('DevStatusBarComponent', () => {
|
|
32
|
+
let originalMockDb: boolean | undefined;
|
|
33
|
+
|
|
34
|
+
beforeEach(() => {
|
|
35
|
+
localStorage.clear();
|
|
36
|
+
originalMockDb = environment['mockDB'];
|
|
37
|
+
|
|
38
|
+
// Reset user admin override paths
|
|
39
|
+
USER_DB[0].isAdmin = true;
|
|
40
|
+
USER_DB[0].adminOverridePaths = [];
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
afterEach(() => {
|
|
44
|
+
environment['mockDB'] = originalMockDb;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should render nothing when there is no mock DB data and no admin override', async () => {
|
|
48
|
+
environment['mockDB'] = true;
|
|
49
|
+
const { fixture } = await setup();
|
|
50
|
+
|
|
51
|
+
const statusBar = fixture.nativeElement.querySelector('.dev-status-bar');
|
|
52
|
+
expect(statusBar).toBeNull();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should render Mock DB warning and handle clearMockData', async () => {
|
|
56
|
+
environment['mockDB'] = true;
|
|
57
|
+
localStorage.setItem('mockUser', '{"uid":"1"}');
|
|
58
|
+
localStorage.setItem('mockDB_users', '[]');
|
|
59
|
+
|
|
60
|
+
const mockLocation = { reload: jest.fn() };
|
|
61
|
+
const { user } = await setup([{ provide: LOCATION, useValue: mockLocation }]);
|
|
62
|
+
|
|
63
|
+
expect(screen.getByText(/Mock DB Cached/i)).toBeVisible();
|
|
64
|
+
|
|
65
|
+
const clearBtn = screen.getByRole('button', { name: /Clear/i });
|
|
66
|
+
await user.click(clearBtn);
|
|
67
|
+
|
|
68
|
+
// Should clear local storage keys
|
|
69
|
+
expect(localStorage.getItem('mockUser')).toBeNull();
|
|
70
|
+
expect(localStorage.getItem('mockDB_users')).toBeNull();
|
|
71
|
+
|
|
72
|
+
// Should reload window
|
|
73
|
+
expect(mockLocation.reload).toHaveBeenCalled();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('should not render Mock DB warning if environment.mockDB is false', async () => {
|
|
77
|
+
environment['mockDB'] = false;
|
|
78
|
+
localStorage.setItem('mockUser', '{"uid":"1"}');
|
|
79
|
+
|
|
80
|
+
const { fixture } = await setup();
|
|
81
|
+
const statusBar = fixture.nativeElement.querySelector('.dev-status-bar');
|
|
82
|
+
expect(statusBar).toBeNull();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('should render Auth Bypassed link when route is in admin override paths', async () => {
|
|
86
|
+
// Set current route to /test-url
|
|
87
|
+
USER_DB[0].adminOverridePaths = ['/test-url'];
|
|
88
|
+
|
|
89
|
+
const { router, fixture } = await setup();
|
|
90
|
+
await router.navigate(['/test-url']);
|
|
91
|
+
fixture.detectChanges();
|
|
92
|
+
|
|
93
|
+
expect(screen.getByText(/Auth Bypassed/i)).toBeVisible();
|
|
94
|
+
const manageLink = screen.getByRole('link', { name: /Manage/i });
|
|
95
|
+
expect(manageLink).toBeVisible();
|
|
96
|
+
expect(manageLink).toHaveAttribute('href', '/admin?tab=settings');
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { Component, inject, computed } from '@angular/core';
|
|
1
|
+
import { Component, inject, computed, InjectionToken } from '@angular/core';
|
|
2
2
|
import { Router, NavigationEnd, RouterLink } from '@angular/router';
|
|
3
|
+
|
|
4
|
+
export const LOCATION = new InjectionToken<Location>('Window Location', {
|
|
5
|
+
providedIn: 'root',
|
|
6
|
+
factory: () => window.location,
|
|
7
|
+
});
|
|
3
8
|
import { MatIcon } from '@angular/material/icon';
|
|
4
9
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
5
10
|
import { filter, map } from 'rxjs/operators';
|
|
@@ -12,11 +17,12 @@ import { environment } from '../../../environments/environment';
|
|
|
12
17
|
standalone: true,
|
|
13
18
|
imports: [MatIcon, RouterLink],
|
|
14
19
|
templateUrl: './dev-status-bar.component.html',
|
|
15
|
-
|
|
20
|
+
styleUrl: './dev-status-bar.component.scss',
|
|
16
21
|
})
|
|
17
22
|
export class DevStatusBarComponent {
|
|
18
23
|
private readonly authStore = inject(AuthStore);
|
|
19
24
|
private readonly router = inject(Router);
|
|
25
|
+
private readonly location = inject(LOCATION);
|
|
20
26
|
|
|
21
27
|
// --------------- INPUTS AND OUTPUTS ------------------
|
|
22
28
|
|
|
@@ -65,6 +71,6 @@ export class DevStatusBarComponent {
|
|
|
65
71
|
localStorage.removeItem(key);
|
|
66
72
|
}
|
|
67
73
|
});
|
|
68
|
-
|
|
74
|
+
this.location.reload();
|
|
69
75
|
}
|
|
70
76
|
}
|
package/src/ng-add/files/src/app/shared/hint-visibility/hint-visibility.directive.spec.ts.template
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { Component, signal } from '@angular/core';
|
|
2
|
+
import { render, screen } from '@testing-library/angular';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { form, required, FormField } from '@angular/forms/signals';
|
|
5
|
+
|
|
6
|
+
import { HintVisibilityDirective } from './hint-visibility.directive';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
template: `
|
|
10
|
+
<div>
|
|
11
|
+
<input [formField]="testForm.control"
|
|
12
|
+
appHintVisibility
|
|
13
|
+
[hintControl]="testForm.control"
|
|
14
|
+
[hintSiblingControl]="testForm.siblingControl"
|
|
15
|
+
[hintCharThreshold]="threshold"
|
|
16
|
+
[hintDebounceMs]="debounceMs"
|
|
17
|
+
#hint="hintVisibility"
|
|
18
|
+
data-testid="test-input" />
|
|
19
|
+
@if (hint.showHint()) {
|
|
20
|
+
<span data-testid="hint-text">Hint Visible</span>
|
|
21
|
+
}
|
|
22
|
+
</div>
|
|
23
|
+
`,
|
|
24
|
+
imports: [HintVisibilityDirective, FormField],
|
|
25
|
+
})
|
|
26
|
+
class TestComponent {
|
|
27
|
+
isSiblingRequired = signal(false);
|
|
28
|
+
|
|
29
|
+
testForm = form(
|
|
30
|
+
signal({ control: '', siblingControl: '' }),
|
|
31
|
+
(p) => {
|
|
32
|
+
required(p.siblingControl, { when: () => this.isSiblingRequired() });
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
threshold = 15;
|
|
37
|
+
debounceMs = 1000;
|
|
38
|
+
|
|
39
|
+
constructor() {
|
|
40
|
+
// Sibling control has validator in some tests, we configure it on demand
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function setup() {
|
|
45
|
+
const user = userEvent.setup({ delay: null });
|
|
46
|
+
const view = await render(TestComponent);
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
user,
|
|
50
|
+
fixture: view.fixture,
|
|
51
|
+
component: view.fixture.componentInstance,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
describe('HintVisibilityDirective', () => {
|
|
56
|
+
let component: TestComponent;
|
|
57
|
+
let fixture: any;
|
|
58
|
+
|
|
59
|
+
beforeEach(async () => {
|
|
60
|
+
const res = await setup();
|
|
61
|
+
component = res.component;
|
|
62
|
+
fixture = res.fixture;
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('should not show hint initially', () => {
|
|
66
|
+
expect(screen.queryByTestId('hint-text')).toBeNull();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('should show hint after debounce time if threshold is not met', async () => {
|
|
70
|
+
// Set value directly since we are using real timers
|
|
71
|
+
fixture.componentInstance.testForm.control().value.set('aaaa');
|
|
72
|
+
fixture.componentInstance.testForm.control().markAsDirty();
|
|
73
|
+
fixture.detectChanges();
|
|
74
|
+
|
|
75
|
+
// Hint should be hidden during debounce
|
|
76
|
+
expect(screen.queryByTestId('hint-text')).not.toBeInTheDocument();
|
|
77
|
+
|
|
78
|
+
// Wait for debounce time (1000ms) + buffer
|
|
79
|
+
await new Promise((resolve) => setTimeout(resolve, 1100));
|
|
80
|
+
fixture.detectChanges();
|
|
81
|
+
|
|
82
|
+
// Hint should now be visible
|
|
83
|
+
expect(screen.getByTestId('hint-text')).toBeVisible();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('should not show hint if threshold is exceeded', async () => {
|
|
87
|
+
// Threshold is 15, let's type 20 chars
|
|
88
|
+
component.testForm.control().value.set('12345678901234567890');
|
|
89
|
+
component.testForm.control().markAsDirty();
|
|
90
|
+
fixture.detectChanges();
|
|
91
|
+
|
|
92
|
+
await new Promise((resolve) => setTimeout(resolve, 1100));
|
|
93
|
+
fixture.detectChanges();
|
|
94
|
+
|
|
95
|
+
expect(screen.queryByTestId('hint-text')).toBeNull();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('should gate hint showing on sibling control validity', async () => {
|
|
99
|
+
// Sibling control has validator and is invalid
|
|
100
|
+
component.isSiblingRequired.set(true);
|
|
101
|
+
component.testForm.siblingControl().value.set('');
|
|
102
|
+
fixture.detectChanges();
|
|
103
|
+
|
|
104
|
+
component.testForm.control().value.set('short');
|
|
105
|
+
component.testForm.control().markAsDirty();
|
|
106
|
+
fixture.detectChanges();
|
|
107
|
+
|
|
108
|
+
await new Promise((resolve) => setTimeout(resolve, 1100));
|
|
109
|
+
fixture.detectChanges();
|
|
110
|
+
|
|
111
|
+
// Should not show since sibling is invalid (required but empty)
|
|
112
|
+
expect(screen.queryByTestId('hint-text')).toBeNull();
|
|
113
|
+
|
|
114
|
+
// Make sibling valid
|
|
115
|
+
component.testForm.siblingControl().value.set('valid sibling');
|
|
116
|
+
fixture.detectChanges();
|
|
117
|
+
|
|
118
|
+
// Trigger control value change again to restart timer
|
|
119
|
+
component.testForm.control().value.set('short again');
|
|
120
|
+
fixture.detectChanges();
|
|
121
|
+
|
|
122
|
+
await new Promise((resolve) => setTimeout(resolve, 1100));
|
|
123
|
+
fixture.detectChanges();
|
|
124
|
+
|
|
125
|
+
expect(screen.getByTestId('hint-text')).toBeVisible();
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('should show hint immediately on blur if control is dirty and has value', () => {
|
|
129
|
+
const inputEl = screen.getByTestId('test-input');
|
|
130
|
+
|
|
131
|
+
component.testForm.control().value.set('short');
|
|
132
|
+
component.testForm.control().markAsDirty();
|
|
133
|
+
fixture.detectChanges();
|
|
134
|
+
|
|
135
|
+
expect(screen.queryByTestId('hint-text')).toBeNull();
|
|
136
|
+
|
|
137
|
+
// Trigger blur event
|
|
138
|
+
inputEl.dispatchEvent(new Event('blur'));
|
|
139
|
+
fixture.detectChanges();
|
|
140
|
+
|
|
141
|
+
expect(screen.getByTestId('hint-text')).toBeVisible();
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('should reset sibling control state on focus if sibling is empty', () => {
|
|
145
|
+
const inputEl = screen.getByTestId('test-input');
|
|
146
|
+
|
|
147
|
+
// Make sibling dirty and touched
|
|
148
|
+
component.testForm.siblingControl().value.set('');
|
|
149
|
+
component.testForm.siblingControl().markAsDirty();
|
|
150
|
+
component.testForm.siblingControl().markAsTouched();
|
|
151
|
+
|
|
152
|
+
expect(component.testForm.siblingControl().dirty()).toBe(true);
|
|
153
|
+
expect(component.testForm.siblingControl().touched()).toBe(true);
|
|
154
|
+
|
|
155
|
+
// Trigger focus event
|
|
156
|
+
inputEl.dispatchEvent(new Event('focus'));
|
|
157
|
+
fixture.detectChanges();
|
|
158
|
+
|
|
159
|
+
// Sibling control should be reset to pristine/untouched
|
|
160
|
+
expect(component.testForm.siblingControl().dirty()).toBe(false);
|
|
161
|
+
expect(component.testForm.siblingControl().touched()).toBe(false);
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
package/src/ng-add/files/src/app/shared/hint-visibility/hint-visibility.directive.ts.template
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Directive, DestroyRef, inject, input, signal, OnInit } from '@angular/core';
|
|
2
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
3
|
-
import { AbstractControl } from '@angular/forms';
|
|
1
|
+
import { Directive, DestroyRef, inject, input, signal, OnInit, Injector, Signal } from '@angular/core';
|
|
2
|
+
import { toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
3
|
import { debounceTime } from 'rxjs/operators';
|
|
4
|
+
import { Field } from '@angular/forms/signals';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Directive that manages when to show a form-field hint based on:
|
|
@@ -20,12 +20,12 @@ import { debounceTime } from 'rxjs/operators';
|
|
|
20
20
|
* ```html
|
|
21
21
|
* <textarea matInput
|
|
22
22
|
* appHintVisibility
|
|
23
|
-
* [hintControl]="surveyForm.
|
|
24
|
-
* [hintSiblingControl]="surveyForm.
|
|
25
|
-
* #
|
|
23
|
+
* [hintControl]="surveyForm.questionOne"
|
|
24
|
+
* [hintSiblingControl]="surveyForm.questionTwo"
|
|
25
|
+
* #questionOneHint="hintVisibility">
|
|
26
26
|
* </textarea>
|
|
27
27
|
*
|
|
28
|
-
* @if (
|
|
28
|
+
* @if (questionOneHint.showHint()) {
|
|
29
29
|
* <mat-hint>Your hint text here</mat-hint>
|
|
30
30
|
* }
|
|
31
31
|
* ```
|
|
@@ -41,17 +41,18 @@ import { debounceTime } from 'rxjs/operators';
|
|
|
41
41
|
})
|
|
42
42
|
export class HintVisibilityDirective implements OnInit {
|
|
43
43
|
private destroyRef = inject(DestroyRef);
|
|
44
|
+
private injector = inject(Injector);
|
|
44
45
|
|
|
45
46
|
// --------------- INPUTS --------------------------------
|
|
46
47
|
|
|
47
48
|
/** The form control attached to this input. */
|
|
48
|
-
hintControl = input.required<
|
|
49
|
+
hintControl = input.required<Field<string>>();
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
52
|
* The sibling form control whose validity gates the timer-based hint.
|
|
52
53
|
* The debounced hint will only appear when this control is valid.
|
|
53
54
|
*/
|
|
54
|
-
hintSiblingControl = input<
|
|
55
|
+
hintSiblingControl = input<Field<string> | null>(null);
|
|
55
56
|
|
|
56
57
|
/**
|
|
57
58
|
* Minimum character count below which the inactivity timer will trigger.
|
|
@@ -72,16 +73,14 @@ export class HintVisibilityDirective implements OnInit {
|
|
|
72
73
|
ngOnInit() {
|
|
73
74
|
const control = this.hintControl();
|
|
74
75
|
|
|
75
|
-
control.
|
|
76
|
+
toObservable(control().value, { injector: this.injector }).pipe(
|
|
76
77
|
// Wait for the configured period of typing inactivity before the
|
|
77
78
|
// *initial* hint trigger. Once visible, the hint stays visible so the
|
|
78
79
|
// user can track their character count in real-time as they type.
|
|
79
80
|
debounceTime(this.hintDebounceMs()),
|
|
80
|
-
|
|
81
81
|
takeUntilDestroyed(this.destroyRef),
|
|
82
82
|
).subscribe((val: string | null) => {
|
|
83
83
|
const length = (val || '').length;
|
|
84
|
-
const sibling = this.hintSiblingControl();
|
|
85
84
|
|
|
86
85
|
// If the field has been cleared, hide the hint — there's nothing
|
|
87
86
|
// useful to show and this prevents a stale hint from persisting
|
|
@@ -91,13 +90,17 @@ export class HintVisibilityDirective implements OnInit {
|
|
|
91
90
|
return;
|
|
92
91
|
}
|
|
93
92
|
|
|
93
|
+
if (this.showHint()) return;
|
|
94
|
+
|
|
95
|
+
const sibling = this.hintSiblingControl();
|
|
96
|
+
|
|
94
97
|
// Show the hint on a delay only when ALL of the following are true:
|
|
95
98
|
// 1. The user has actually typed something (dirty).
|
|
96
99
|
// 2. They haven't yet reached the character threshold.
|
|
97
100
|
// 3. The sibling control (if provided) is already valid.
|
|
98
101
|
// If the threshold is met, the hint will only appear on blur instead.
|
|
99
|
-
const siblingValid = sibling ? sibling.valid : true;
|
|
100
|
-
if (control.dirty && length < this.hintCharThreshold() && siblingValid) {
|
|
102
|
+
const siblingValid = sibling ? sibling().valid() : true;
|
|
103
|
+
if (control().dirty() && length < this.hintCharThreshold() && siblingValid) {
|
|
101
104
|
this.showHint.set(true);
|
|
102
105
|
}
|
|
103
106
|
});
|
|
@@ -111,7 +114,7 @@ export class HintVisibilityDirective implements OnInit {
|
|
|
111
114
|
// Only show on blur if there's actual content — if the user typed
|
|
112
115
|
// and then deleted everything, we don't want to latch showHint to
|
|
113
116
|
// true since there's nothing useful to hint about.
|
|
114
|
-
if (control.dirty && control.value) {
|
|
117
|
+
if (control().dirty() && control().value()) {
|
|
115
118
|
this.showHint.set(true);
|
|
116
119
|
}
|
|
117
120
|
}
|
|
@@ -123,9 +126,8 @@ export class HintVisibilityDirective implements OnInit {
|
|
|
123
126
|
*/
|
|
124
127
|
onFocus() {
|
|
125
128
|
const sibling = this.hintSiblingControl();
|
|
126
|
-
if (sibling && !sibling.value) {
|
|
127
|
-
sibling.
|
|
128
|
-
sibling.markAsPristine();
|
|
129
|
+
if (sibling && !sibling().value()) {
|
|
130
|
+
sibling().reset();
|
|
129
131
|
}
|
|
130
132
|
}
|
|
131
133
|
}
|
|
@@ -1,37 +1,58 @@
|
|
|
1
|
-
import { render } from '@testing-library/angular';
|
|
1
|
+
import { render, screen } from '@testing-library/angular';
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { Provider } from '@angular/core';
|
|
3
4
|
|
|
4
5
|
import { NavbarComponent } from './navbar.component';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
6
|
+
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
7
|
+
import { AuthMockDB, AuthLoggedInMockDB } from 'src/app/core/store/auth/auth.mock';
|
|
8
|
+
import { USER_DB } from 'src/app/core/store/user/user.mock';
|
|
9
9
|
|
|
10
|
-
/** Sets up the testing environment for NavbarComponent using render
|
|
11
|
-
async function setup() {
|
|
10
|
+
/** Sets up the testing environment for NavbarComponent using render. */
|
|
11
|
+
async function setup(providers: Provider[] = []) {
|
|
12
12
|
const user = userEvent.setup();
|
|
13
|
-
const checkedSpy = jest.fn();
|
|
14
13
|
|
|
15
14
|
const view = await render(NavbarComponent, {
|
|
16
|
-
imports: [],
|
|
17
15
|
providers: [
|
|
18
|
-
{ provide:
|
|
19
|
-
|
|
16
|
+
{ provide: AuthStore, useClass: AuthMockDB },
|
|
17
|
+
...providers,
|
|
20
18
|
],
|
|
21
|
-
componentInputs: {},
|
|
22
|
-
on: {},
|
|
23
19
|
});
|
|
24
20
|
|
|
25
21
|
return {
|
|
26
22
|
user,
|
|
27
23
|
fixture: view.fixture,
|
|
28
|
-
|
|
24
|
+
authStore: view.fixture.debugElement.injector.get(AuthStore),
|
|
29
25
|
};
|
|
30
26
|
}
|
|
31
27
|
|
|
32
28
|
describe('NavbarComponent', () => {
|
|
33
|
-
it('should
|
|
34
|
-
|
|
35
|
-
expect(
|
|
29
|
+
it('should not show profile picture when logged out', async () => {
|
|
30
|
+
await setup();
|
|
31
|
+
expect(screen.queryByRole('img')).toBeNull();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should show profile picture when logged in, and clicking it opens menu with logout option', async () => {
|
|
35
|
+
const { user, authStore } = await setup([
|
|
36
|
+
{ provide: AuthStore, useClass: AuthLoggedInMockDB },
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
const profilePic = screen.getByRole('img');
|
|
40
|
+
expect(profilePic).toBeVisible();
|
|
41
|
+
expect(profilePic).toHaveAttribute('src', USER_DB[0].photoURL);
|
|
42
|
+
|
|
43
|
+
// Menu should not be in the document initially
|
|
44
|
+
expect(screen.queryByText(/Logout/i)).toBeNull();
|
|
45
|
+
|
|
46
|
+
// Click profile pic to open menu
|
|
47
|
+
await user.click(profilePic);
|
|
48
|
+
|
|
49
|
+
// Logout should be visible now
|
|
50
|
+
const logoutBtn = screen.getByText(/Logout/i);
|
|
51
|
+
expect(logoutBtn).toBeVisible();
|
|
52
|
+
|
|
53
|
+
const logoutSpy = jest.spyOn(authStore, 'logout');
|
|
54
|
+
await user.click(logoutBtn);
|
|
55
|
+
expect(logoutSpy).toHaveBeenCalled();
|
|
56
|
+
logoutSpy.mockRestore();
|
|
36
57
|
});
|
|
37
58
|
});
|
|
@@ -6,7 +6,7 @@ import { MatMenuTrigger, MatMenu } from '@angular/material/menu';
|
|
|
6
6
|
@Component({
|
|
7
7
|
selector: 'app-navbar',
|
|
8
8
|
templateUrl: './navbar.component.html',
|
|
9
|
-
|
|
9
|
+
styleUrl: './navbar.component.scss',
|
|
10
10
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
11
11
|
imports: [MatMenuTrigger, MatMenu],
|
|
12
12
|
})
|
|
@@ -1,30 +1,69 @@
|
|
|
1
|
-
import { render } from '@testing-library/angular';
|
|
1
|
+
import { render, screen } from '@testing-library/angular';
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import { Provider } from '@angular/core';
|
|
3
5
|
|
|
4
6
|
import { RedeploymentWarningComponent } from './redeployment-warning.component';
|
|
7
|
+
import { DetectRedeploymentService } from './redeployment-warning.service';
|
|
5
8
|
|
|
6
|
-
/** Sets up the testing environment for RedeploymentWarningComponent using render
|
|
9
|
+
/** Sets up the testing environment for RedeploymentWarningComponent using render. */
|
|
7
10
|
async function setup() {
|
|
8
11
|
const user = userEvent.setup();
|
|
9
|
-
const
|
|
12
|
+
const redeployedSubject = new Subject<void>();
|
|
13
|
+
const detectRedeploymentMock = {
|
|
14
|
+
redeployed: jest.fn().mockReturnValue(redeployedSubject.asObservable()),
|
|
15
|
+
refresh: jest.fn(),
|
|
16
|
+
};
|
|
10
17
|
|
|
11
18
|
const view = await render(RedeploymentWarningComponent, {
|
|
12
19
|
imports: [],
|
|
13
|
-
providers: [
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
providers: [
|
|
21
|
+
{ provide: DetectRedeploymentService, useValue: detectRedeploymentMock },
|
|
22
|
+
],
|
|
16
23
|
});
|
|
17
24
|
|
|
18
25
|
return {
|
|
19
26
|
user,
|
|
20
27
|
fixture: view.fixture,
|
|
21
|
-
|
|
28
|
+
detectRedeploymentMock,
|
|
29
|
+
redeployedSubject,
|
|
22
30
|
};
|
|
23
31
|
}
|
|
24
32
|
|
|
25
33
|
describe('RedeploymentWarningComponent', () => {
|
|
26
|
-
it('should
|
|
27
|
-
|
|
28
|
-
expect(
|
|
34
|
+
it('should not show warning initially', async () => {
|
|
35
|
+
await setup();
|
|
36
|
+
expect(screen.queryByText(/This version is out of date/i)).toBeNull();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should show warning when redeployment is detected, and close it when clicked', async () => {
|
|
40
|
+
const { user, redeployedSubject, fixture } = await setup();
|
|
41
|
+
|
|
42
|
+
// Trigger redeployment
|
|
43
|
+
redeployedSubject.next();
|
|
44
|
+
fixture.detectChanges();
|
|
45
|
+
|
|
46
|
+
// Warning should be visible
|
|
47
|
+
expect(screen.getByText(/This version is out of date/i)).toBeVisible();
|
|
48
|
+
|
|
49
|
+
// Click close icon
|
|
50
|
+
const closeBtn = screen.getByRole('img');
|
|
51
|
+
await user.click(closeBtn);
|
|
52
|
+
|
|
53
|
+
// Warning should be hidden
|
|
54
|
+
expect(screen.queryByText(/This version is out of date/i)).toBeNull();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should call refresh on the service when Update Now is clicked', async () => {
|
|
58
|
+
const { user, redeployedSubject, detectRedeploymentMock, fixture } = await setup();
|
|
59
|
+
|
|
60
|
+
// Trigger redeployment
|
|
61
|
+
redeployedSubject.next();
|
|
62
|
+
fixture.detectChanges();
|
|
63
|
+
|
|
64
|
+
const updateBtn = screen.getByRole('button', { name: /Update Now/i });
|
|
65
|
+
await user.click(updateBtn);
|
|
66
|
+
|
|
67
|
+
expect(detectRedeploymentMock.refresh).toHaveBeenCalled();
|
|
29
68
|
});
|
|
30
69
|
});
|