From a5241aebcdde9a57acc8c3d7cea67d802ab91f29 Mon Sep 17 00:00:00 2001 From: Duncan Carter Date: Thu, 9 Jan 2025 11:39:46 +0000 Subject: [PATCH] Rename component and function in user service --- frontend/src/app/app-routing.module.ts | 6 ++--- frontend/src/app/app.module.ts | 4 ++-- .../src/app/core/services/user.service.ts | 2 +- ...and-turnover-login-message.component.html} | 0 ...-turnover-login-message.component.spec.ts} | 22 ++++++++++--------- ...s-and-turnover-login-message.component.ts} | 8 +++---- 6 files changed, 22 insertions(+), 20 deletions(-) rename frontend/src/app/features/login/{starters-leavers-vacancies-login-message/starters-leavers-vacancies-login-message.component.html => vacancies-and-turnover-login-message/vacancies-and-turnover-login-message.component.html} (100%) rename frontend/src/app/features/login/{starters-leavers-vacancies-login-message/starters-leavers-vacancies-login-message.component.spec.ts => vacancies-and-turnover-login-message/vacancies-and-turnover-login-message.component.spec.ts} (53%) rename frontend/src/app/features/login/{starters-leavers-vacancies-login-message/starters-leavers-vacancies-login-message.component.ts => vacancies-and-turnover-login-message/vacancies-and-turnover-login-message.component.ts} (52%) diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index 946573d197..bd9b73cb30 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -31,11 +31,11 @@ import { FirstLoginPageComponent } from '@features/first-login-page/first-login- import { ForgotYourPasswordComponent } from '@features/forgot-your-username-or-password/forgot-your-password/forgot-your-password.component'; import { ForgotYourUsernameOrPasswordComponent } from '@features/forgot-your-username-or-password/forgot-your-username-or-password.component'; import { ForgotYourUsernameComponent } from '@features/forgot-your-username-or-password/forgot-your-username/forgot-your-username.component'; -import { UsernameFoundComponent } from '@features/forgot-your-username-or-password/username-found/username-found.component'; import { SecurityQuestionAnswerNotMatchComponent } from '@features/forgot-your-username-or-password/forgot-your-username/security-question-answer-not-match/security-question-answer-not-match.component'; import { UserAccountNotFoundComponent } from '@features/forgot-your-username-or-password/forgot-your-username/user-account-not-found/user-account-not-found.component'; +import { UsernameFoundComponent } from '@features/forgot-your-username-or-password/username-found/username-found.component'; import { LoginComponent } from '@features/login/login.component'; -import { StartersLeaversVacanciesLoginMessageComponent } from '@features/login/starters-leavers-vacancies-login-message/starters-leavers-vacancies-login-message.component'; +import { VacanciesAndTurnoverLoginMessage } from '@features/login/vacancies-and-turnover-login-message/vacancies-and-turnover-login-message.component'; import { LogoutComponent } from '@features/logout/logout.component'; import { MigratedUserTermsConditionsComponent } from '@features/migrated-user-terms-conditions/migrated-user-terms-conditions.component'; import { BecomeAParentComponent } from '@features/new-dashboard/become-a-parent/become-a-parent.component'; @@ -151,7 +151,7 @@ const routes: Routes = [ }, { path: 'update-your-vacancies-and-turnover-data', - component: StartersLeaversVacanciesLoginMessageComponent, + component: VacanciesAndTurnoverLoginMessage, data: { title: 'Update your vacancies and turnover data' }, }, { diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 23e7e151bb..4176ff3104 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -71,7 +71,7 @@ import { SecurityQuestionAnswerNotMatchComponent } from '@features/forgot-your-u import { UserAccountNotFoundComponent } from '@features/forgot-your-username-or-password/forgot-your-username/user-account-not-found/user-account-not-found.component'; import { UsernameFoundComponent } from '@features/forgot-your-username-or-password/username-found/username-found.component'; import { LoginComponent } from '@features/login/login.component'; -import { StartersLeaversVacanciesLoginMessageComponent } from '@features/login/starters-leavers-vacancies-login-message/starters-leavers-vacancies-login-message.component'; +import { VacanciesAndTurnoverLoginMessage } from '@features/login/vacancies-and-turnover-login-message/vacancies-and-turnover-login-message.component'; import { LogoutComponent } from '@features/logout/logout.component'; import { BecomeAParentComponent } from '@features/new-dashboard/become-a-parent/become-a-parent.component'; import { DashboardWrapperComponent } from '@features/new-dashboard/dashboard-wrapper.component'; @@ -151,7 +151,7 @@ import { SentryErrorHandler } from './SentryErrorHandler.component'; SelectStarterJobRolesComponent, SecurityQuestionAnswerNotMatchComponent, UserAccountNotFoundComponent, - StartersLeaversVacanciesLoginMessageComponent, + VacanciesAndTurnoverLoginMessage, ], imports: [ Angulartics2Module.forRoot({ diff --git a/frontend/src/app/core/services/user.service.ts b/frontend/src/app/core/services/user.service.ts index fd1acc904f..ff2ec9e55f 100644 --- a/frontend/src/app/core/services/user.service.ts +++ b/frontend/src/app/core/services/user.service.ts @@ -184,7 +184,7 @@ export class UserService { .pipe(map((response) => response.users)); } - public updateSLVMessage() { + public updateLastViewedVacanciesAndTurnoverLoginMessage() { return this.http.post( `${environment.appRunnerEndpoint}/api/user/update-last-viewed-slv-message/${this.loggedInUser.uid}`, {}, diff --git a/frontend/src/app/features/login/starters-leavers-vacancies-login-message/starters-leavers-vacancies-login-message.component.html b/frontend/src/app/features/login/vacancies-and-turnover-login-message/vacancies-and-turnover-login-message.component.html similarity index 100% rename from frontend/src/app/features/login/starters-leavers-vacancies-login-message/starters-leavers-vacancies-login-message.component.html rename to frontend/src/app/features/login/vacancies-and-turnover-login-message/vacancies-and-turnover-login-message.component.html diff --git a/frontend/src/app/features/login/starters-leavers-vacancies-login-message/starters-leavers-vacancies-login-message.component.spec.ts b/frontend/src/app/features/login/vacancies-and-turnover-login-message/vacancies-and-turnover-login-message.component.spec.ts similarity index 53% rename from frontend/src/app/features/login/starters-leavers-vacancies-login-message/starters-leavers-vacancies-login-message.component.spec.ts rename to frontend/src/app/features/login/vacancies-and-turnover-login-message/vacancies-and-turnover-login-message.component.spec.ts index c890bc1941..c963d47f96 100644 --- a/frontend/src/app/features/login/starters-leavers-vacancies-login-message/starters-leavers-vacancies-login-message.component.spec.ts +++ b/frontend/src/app/features/login/vacancies-and-turnover-login-message/vacancies-and-turnover-login-message.component.spec.ts @@ -5,13 +5,15 @@ import { SharedModule } from '@shared/shared.module'; import { render } from '@testing-library/angular'; import { of } from 'rxjs'; -import { StartersLeaversVacanciesLoginMessageComponent } from './starters-leavers-vacancies-login-message.component'; +import { VacanciesAndTurnoverLoginMessage } from './vacancies-and-turnover-login-message.component'; -describe('StartersLeaversVacanciesLoginMessageComponent', () => { +describe('VacanciesAndTurnoverLoginMessage', () => { async function setup() { - const updateSLVMessageSpy = jasmine.createSpy('updateSLVMessage').and.returnValue(of(null)); + const updateLastViewedVacanciesAndTurnoverLoginMessageSpy = jasmine + .createSpy('updateLastViewedVacanciesAndTurnoverLoginMessage') + .and.returnValue(of(null)); - const setupTools = await render(StartersLeaversVacanciesLoginMessageComponent, { + const setupTools = await render(VacanciesAndTurnoverLoginMessage, { imports: [SharedModule, RouterModule, RouterTestingModule], providers: [ { @@ -20,7 +22,7 @@ describe('StartersLeaversVacanciesLoginMessageComponent', () => { loggedInUser: { uid: 'ajoij3213213213', }, - updateSLVMessage: updateSLVMessageSpy, + updateLastViewedVacanciesAndTurnoverLoginMessage: updateLastViewedVacanciesAndTurnoverLoginMessageSpy, }, }, ], @@ -31,11 +33,11 @@ describe('StartersLeaversVacanciesLoginMessageComponent', () => { return { ...setupTools, component, - updateSLVMessageSpy, + updateLastViewedVacanciesAndTurnoverLoginMessageSpy, }; } - it('should render a StartersLeaversVacanciesLoginMessageComponent', async () => { + it('should render a VacanciesAndTurnoverLoginMessage', async () => { const { component } = await setup(); expect(component).toBeTruthy(); @@ -49,9 +51,9 @@ describe('StartersLeaversVacanciesLoginMessageComponent', () => { expect(continueButton.getAttribute('href')).toEqual('/dashboard'); }); - it('should call updateSLVMessage in UserService on page load', async () => { - const { updateSLVMessageSpy } = await setup(); + it('should call updateLastViewedVacanciesAndTurnoverLoginMessage in UserService on page load', async () => { + const { updateLastViewedVacanciesAndTurnoverLoginMessageSpy } = await setup(); - expect(updateSLVMessageSpy).toHaveBeenCalled(); + expect(updateLastViewedVacanciesAndTurnoverLoginMessageSpy).toHaveBeenCalled(); }); }); diff --git a/frontend/src/app/features/login/starters-leavers-vacancies-login-message/starters-leavers-vacancies-login-message.component.ts b/frontend/src/app/features/login/vacancies-and-turnover-login-message/vacancies-and-turnover-login-message.component.ts similarity index 52% rename from frontend/src/app/features/login/starters-leavers-vacancies-login-message/starters-leavers-vacancies-login-message.component.ts rename to frontend/src/app/features/login/vacancies-and-turnover-login-message/vacancies-and-turnover-login-message.component.ts index b0c7c5f6aa..838b264c67 100644 --- a/frontend/src/app/features/login/starters-leavers-vacancies-login-message/starters-leavers-vacancies-login-message.component.ts +++ b/frontend/src/app/features/login/vacancies-and-turnover-login-message/vacancies-and-turnover-login-message.component.ts @@ -3,14 +3,14 @@ import { UserService } from '@core/services/user.service'; import { Subscription } from 'rxjs'; @Component({ - selector: 'app-starters-leavers-vacancies-login-message', - templateUrl: './starters-leavers-vacancies-login-message.component.html', + selector: 'app-vacancies-and-turnover-login-message', + templateUrl: './vacancies-and-turnover-login-message.component.html', }) -export class StartersLeaversVacanciesLoginMessageComponent implements OnDestroy { +export class VacanciesAndTurnoverLoginMessage implements OnDestroy { private subscriptions: Subscription = new Subscription(); constructor(private userService: UserService) { - this.subscriptions.add(this.userService.updateSLVMessage().subscribe(() => {})); + this.subscriptions.add(this.userService.updateLastViewedVacanciesAndTurnoverLoginMessage().subscribe(() => {})); } ngOnDestroy(): void {