-

{{ selectedOrganisation != null ? selectedOrganisation.name : "" }}

+

{{ selectedDepartment != null ? selectedDepartment.name : "" }}

- {{ selectedOrganisation != null ? selectedOrganisation.description : "" }} + {{ selectedDepartment != null ? selectedDepartment.description : "" }}

-

Organisation Members

- +

Department Members

+
- The organisation members list displays all approvers at the selected - organisation as well as any members of the organisation that you share a - project with. + The department members list displays all approvers at the selected department as + well as any members of the department that you share a project with.
- +
- +
- Contains all organisation scoped requests for this organisation that were - created by you. + Contains all department scoped requests for this department that were created by + you.
- -
- + +
+
- A list of all organisation scoped requests that require approval at this - organisation. + A list of all department scoped requests that require approval at this department.
diff --git a/src/app/secure-data-environment/pages/departments/departments.component.spec.ts b/src/app/secure-data-environment/pages/departments/departments.component.spec.ts index 13ae657a..1a342086 100644 --- a/src/app/secure-data-environment/pages/departments/departments.component.spec.ts +++ b/src/app/secure-data-environment/pages/departments/departments.component.spec.ts @@ -18,37 +18,34 @@ SPDX-License-Identifier: Apache-2.0 */ import { DepartmentsComponent } from './departments.component'; import { SdeDepartmentService } from '../../services/sde-department.service'; -import { createSdeOrganisationServiceStub } from '../../../testing/stubs/sde/sde-department-service.stub'; +import { createSdeDepartmentServiceStub } from '../../../testing/stubs/sde/sde-department-service.stub'; +import { ComponentHarness, setupTestModuleForComponent } from '../../../testing/testing.helpers'; import { - ComponentHarness, - setupTestModuleForComponent, -} from '../../../testing/testing.helpers'; -import { - APPROVER_DISPLAY_COLUMNS_FOR_ORG_MEMBER_LIST, + APPROVER_DISPLAY_COLUMNS_FOR_DEPT_MEMBER_LIST, + MEMBER_DISPLAY_COLUMNS_FOR_DEPT_MEMBER_LIST, ListColumn, - MEMBER_DISPLAY_COLUMNS_FOR_ORG_MEMBER_LIST, - Organisation, - OrganisationMemberService, - UserOrganisationDTO, + Department, + DepartmentMemberService, + UserDepartmentDTO, } from '@maurodatamapper/sde-resources'; -import { createOrganisationMemberServiceStub } from '../../../testing/stubs/sde/department-member.service.stub'; +import { createDepartmentMemberServiceStub } from '../../../testing/stubs/sde/department-member.service.stub'; import { of } from 'rxjs'; describe('DepartmentsComponent', () => { let harness: ComponentHarness; - const sdeOrganisationServiceStub = createSdeOrganisationServiceStub(); - const organisationMemberService = createOrganisationMemberServiceStub(); + const sdeDepartmentServiceStub = createSdeDepartmentServiceStub(); + const departmentMemberService = createDepartmentMemberServiceStub(); beforeEach(async () => { harness = await setupTestModuleForComponent(DepartmentsComponent, { providers: [ { provide: SdeDepartmentService, - useValue: sdeOrganisationServiceStub, + useValue: sdeDepartmentServiceStub, }, { - provide: OrganisationMemberService, - useValue: organisationMemberService, + provide: DepartmentMemberService, + useValue: departmentMemberService, }, ], }); @@ -58,58 +55,54 @@ describe('DepartmentsComponent', () => { expect(harness.component).toBeTruthy(); }); - describe('ngOnInit: setting initial selectedOrg, myOrganisations, userHasOrganisations, and displayColumns', () => { - it('should handle the case where the user has no organisations', () => { - sdeOrganisationServiceStub.getUsersOrganisations.mockReturnValueOnce(of([])); + describe('ngOnInit: setting initial selectedDept, myDepartments, userHasDepartments, and displayColumns', () => { + it('should handle the case where the user has no departments', () => { + sdeDepartmentServiceStub.getUsersDepartments.mockReturnValueOnce(of([])); harness.detectChanges(); - expect(harness.component.myOrganisations).toEqual([]); - expect(harness.component.selectedOrganisation).toBeUndefined(); - expect(harness.component.userHasOrganisations).toBe(false); - expect(harness.component.displayColumnsForOrganisationMemberList).toEqual([]); + expect(harness.component.myDepartments).toEqual([]); + expect(harness.component.selectedDepartment).toBeUndefined(); + expect(harness.component.userHasDepartments).toBe(false); + expect(harness.component.displayColumnsForDepartmentMemberList).toEqual([]); }); it('should initialise for an APPROVER', () => { - const userOrgs = [{ organisationId: '1', role: 'APPROVER' } as UserOrganisationDTO]; - const expectedOrg = { id: '1' } as Organisation; - const expectedDisplayColumns = APPROVER_DISPLAY_COLUMNS_FOR_ORG_MEMBER_LIST; - - sdeOrganisationServiceStub.getUsersOrganisations.mockReturnValueOnce(of(userOrgs)); - sdeOrganisationServiceStub.get.mockReturnValueOnce(of(expectedOrg)); - organisationMemberService.getDisplayColumnsForResearcher.mockReturnValueOnce( - APPROVER_DISPLAY_COLUMNS_FOR_ORG_MEMBER_LIST as ListColumn[] + const userDepts = [{ departmentId: '1', role: 'APPROVER' } as UserDepartmentDTO]; + const expectedDept = { id: '1' } as Department; + const expectedDisplayColumns = APPROVER_DISPLAY_COLUMNS_FOR_DEPT_MEMBER_LIST; + + sdeDepartmentServiceStub.getUsersDepartments.mockReturnValueOnce(of(userDepts)); + sdeDepartmentServiceStub.get.mockReturnValueOnce(of(expectedDept)); + departmentMemberService.getDisplayColumnsForResearcher.mockReturnValueOnce( + APPROVER_DISPLAY_COLUMNS_FOR_DEPT_MEMBER_LIST as ListColumn[] ); harness.detectChanges(); - expect(harness.component.myOrganisations).toEqual(userOrgs); - expect(harness.component.selectedOrganisation).toEqual(expectedOrg); - expect(harness.component.userHasOrganisations).toBe(true); - expect(harness.component.displayColumnsForOrganisationMemberList).toBe( - expectedDisplayColumns - ); + expect(harness.component.myDepartments).toEqual(userDepts); + expect(harness.component.selectedDepartment).toEqual(expectedDept); + expect(harness.component.userHasDepartments).toBe(true); + expect(harness.component.displayColumnsForDepartmentMemberList).toBe(expectedDisplayColumns); }); it('should initialise for a MEMBER', () => { - const userOrgs = [{ organisationId: '1', role: 'MEMBER' } as UserOrganisationDTO]; - const expectedOrg = { id: '1' } as Organisation; - const expectedDisplayColumns = MEMBER_DISPLAY_COLUMNS_FOR_ORG_MEMBER_LIST; - - sdeOrganisationServiceStub.getUsersOrganisations.mockReturnValueOnce(of(userOrgs)); - sdeOrganisationServiceStub.get.mockReturnValueOnce(of(expectedOrg)); - organisationMemberService.getDisplayColumnsForResearcher.mockReturnValueOnce( - MEMBER_DISPLAY_COLUMNS_FOR_ORG_MEMBER_LIST as ListColumn[] + const userDepts = [{ departmentId: '1', role: 'MEMBER' } as UserDepartmentDTO]; + const expectedDept = { id: '1' } as Department; + const expectedDisplayColumns = MEMBER_DISPLAY_COLUMNS_FOR_DEPT_MEMBER_LIST; + + sdeDepartmentServiceStub.getUsersDepartments.mockReturnValueOnce(of(userDepts)); + sdeDepartmentServiceStub.get.mockReturnValueOnce(of(expectedDept)); + departmentMemberService.getDisplayColumnsForResearcher.mockReturnValueOnce( + MEMBER_DISPLAY_COLUMNS_FOR_DEPT_MEMBER_LIST as ListColumn[] ); harness.detectChanges(); - expect(harness.component.myOrganisations).toEqual(userOrgs); - expect(harness.component.selectedOrganisation).toEqual(expectedOrg); - expect(harness.component.userHasOrganisations).toBe(true); - expect(harness.component.displayColumnsForOrganisationMemberList).toBe( - expectedDisplayColumns - ); + expect(harness.component.myDepartments).toEqual(userDepts); + expect(harness.component.selectedDepartment).toEqual(expectedDept); + expect(harness.component.userHasDepartments).toBe(true); + expect(harness.component.displayColumnsForDepartmentMemberList).toBe(expectedDisplayColumns); }); }); }); diff --git a/src/app/secure-data-environment/pages/departments/departments.component.ts b/src/app/secure-data-environment/pages/departments/departments.component.ts index a90e1f24..d6a74e10 100644 --- a/src/app/secure-data-environment/pages/departments/departments.component.ts +++ b/src/app/secure-data-environment/pages/departments/departments.component.ts @@ -18,11 +18,11 @@ SPDX-License-Identifier: Apache-2.0 */ import { Component, OnInit } from '@angular/core'; import { + Department, + DepartmentMemberService, ListColumn, - Organisation, - OrganisationMemberService, RequestsListMode, - UserOrganisationDTO, + UserDepartmentDTO, Uuid, } from '@maurodatamapper/sde-resources'; import { SdeDepartmentService } from '../../services/sde-department.service'; @@ -34,82 +34,78 @@ import { switchMap, EMPTY, of, forkJoin } from 'rxjs'; styleUrls: ['./departments.component.scss'], }) export class DepartmentsComponent implements OnInit { - selectedOrganisation: Organisation | undefined = undefined; - selectedOrganisationId = this.selectedOrganisation?.id; - displayColumnsForOrganisationMemberList: ListColumn[] = []; - myOrganisations: UserOrganisationDTO[] = []; - userHasOrganisations = true; - userIsApproverForSelectedOrganisation = false; + selectedDepartment: Department | undefined = undefined; + selectedDepartmentId = this.selectedDepartment?.id; + displayColumnsForDepartmentMemberList: ListColumn[] = []; + myDepartments: UserDepartmentDTO[] = []; + userHasDepartments = true; + userIsApproverForSelectedDepartment = false; requestsNeedingApprovalListConfig: RequestsListMode = RequestsListMode.CanAuthorise; - myRequestsListConfig: RequestsListMode = RequestsListMode.MyOrganisationRequests; + myRequestsListConfig: RequestsListMode = RequestsListMode.MyDepartmentRequests; constructor( - private sdeOrganisationService: SdeDepartmentService, - private organisationMemberService: OrganisationMemberService - ) { } + private sdeDepartmentService: SdeDepartmentService, + private departmentMemberService: DepartmentMemberService + ) {} ngOnInit(): void { - this.sdeOrganisationService - .getUsersOrganisations() + this.sdeDepartmentService + .getUsersDepartments() .pipe( - switchMap((userOrgs: UserOrganisationDTO[]) => { - // Theoretically, a user should always have an organisation. If they don't, trigger + switchMap((userDepts: UserDepartmentDTO[]) => { + // Theoretically, a user should always have an department. If they don't, trigger // a flag to show a message to the user. - if (userOrgs.length === 0) { - this.userHasOrganisations = false; + if (userDepts.length === 0) { + this.userHasDepartments = false; return EMPTY; } - this.myOrganisations = userOrgs; - const initialOrgValue = this.myOrganisations[0] as UserOrganisationDTO; + this.myDepartments = userDepts; + const initialDeptValue = this.myDepartments[0] as UserDepartmentDTO; return forkJoin([ - this.sdeOrganisationService.get(initialOrgValue.organisationId), - of(userOrgs), + this.sdeDepartmentService.get(initialDeptValue.departmentId), + of(userDepts), ]); }) ) - .subscribe(([initialOrg, userOrgs]: [Organisation, UserOrganisationDTO[]]) => { - this.setSelectedOrganisationAndDisplayColumns(initialOrg, userOrgs); + .subscribe(([initialDept, userDepts]: [Department, UserDepartmentDTO[]]) => { + this.setSelectedDepartmentAndDisplayColumns(initialDept, userDepts); }); } - onOrganisationSelectEvent(value: UserOrganisationDTO) { - const selectedOrgId = value.organisationId as Uuid; - this.sdeOrganisationService - .get(selectedOrgId) - .subscribe((org: Organisation | undefined) => { - this.setSelectedOrganisationAndDisplayColumns(org, this.myOrganisations); - }); + onDepartmentSelectEvent(value: UserDepartmentDTO) { + const selectedOrgId = value.departmentId as Uuid; + this.sdeDepartmentService.get(selectedOrgId).subscribe((dept: Department | undefined) => { + this.setSelectedDepartmentAndDisplayColumns(dept, this.myDepartments); + }); } /** - * Each time the user selects a new organisation, we need to modify what information they are - * allowed to see. Therefore the organisation and userRole info need to be updated and passed into - * the organisation member list component. + * Each time the user selects a new department, we need to modify what information they are + * allowed to see. Therefore the department and userRole info need to be updated and passed into + * the department member list component. */ - private setSelectedOrganisationAndDisplayColumns( - selectedOrg: Organisation | undefined, - userOrgs: UserOrganisationDTO[] + private setSelectedDepartmentAndDisplayColumns( + selectedDept: Department | undefined, + userDepts: UserDepartmentDTO[] ) { - // Find the user's role at the selected organisation. - const userRoleAtSelectedOrg = userOrgs.find( - (org) => org.organisationId === selectedOrg?.id + // Find the user's role at the selected department. + const userRoleAtSelectedDept = userDepts.find( + (dept) => dept.departmentId === selectedDept?.id )?.role; - // If no organisation or role, keep the selectedOrganisation value as it's default: undefined. + // If no department or role, keep the selectedDepartment value as it's default: undefined. // An error message will be displayed to the user. - if (!selectedOrg || !userRoleAtSelectedOrg) { + if (!selectedDept || !userRoleAtSelectedDept) { return; } - this.selectedOrganisation = selectedOrg; - this.userIsApproverForSelectedOrganisation = userRoleAtSelectedOrg === 'APPROVER'; + this.selectedDepartment = selectedDept; + this.userIsApproverForSelectedDepartment = userRoleAtSelectedDept === 'APPROVER'; - this.displayColumnsForOrganisationMemberList = - this.organisationMemberService.getDisplayColumnsForResearcher( - userRoleAtSelectedOrg - ); + this.displayColumnsForDepartmentMemberList = + this.departmentMemberService.getDisplayColumnsForResearcher(userRoleAtSelectedDept); } } diff --git a/src/app/secure-data-environment/sde-sign-in/sde-sign-in.component.html b/src/app/secure-data-environment/sde-sign-in/sde-sign-in.component.html index 1cb46744..2ddf0b57 100644 --- a/src/app/secure-data-environment/sde-sign-in/sde-sign-in.component.html +++ b/src/app/secure-data-environment/sde-sign-in/sde-sign-in.component.html @@ -17,8 +17,8 @@ SPDX-License-Identifier: Apache-2.0 -->

- You are not signed in to the Secure Data Environment (SDE). Please select one of the - options below to access your organisations, projects and requests. + You are not signed in to the Secure Data Environment (SDE). Please select one of the options below + to access your departments, projects and requests.

You can find more information about the SDE at the diff --git a/src/app/secure-data-environment/services/sde-department.service.spec.ts b/src/app/secure-data-environment/services/sde-department.service.spec.ts index bf182f8e..602838d0 100644 --- a/src/app/secure-data-environment/services/sde-department.service.spec.ts +++ b/src/app/secure-data-environment/services/sde-department.service.spec.ts @@ -18,20 +18,20 @@ SPDX-License-Identifier: Apache-2.0 */ import { setupTestModuleForService } from '../../testing/testing.helpers'; import { SdeDepartmentService } from './sde-department.service'; -import { createSdeOrganisationEndpointsStub } from '../../testing/stubs/sde/department-endpoints.stub'; -import { Organisation, OrganisationEndpoints } from '@maurodatamapper/sde-resources'; +import { createSdeDepartmentEndpointsStub } from '../../testing/stubs/sde/department-endpoints.stub'; +import { Department, DepartmentEndpoints } from '@maurodatamapper/sde-resources'; import { of } from 'rxjs'; describe('SdeDepartmentService', () => { let service: SdeDepartmentService; - const organisationEndpointsStub = createSdeOrganisationEndpointsStub(); + const departmentEndpointsStub = createSdeDepartmentEndpointsStub(); beforeEach(() => { service = setupTestModuleForService(SdeDepartmentService, { providers: [ { - provide: OrganisationEndpoints, - useValue: organisationEndpointsStub, + provide: DepartmentEndpoints, + useValue: departmentEndpointsStub, }, ], }); @@ -41,35 +41,35 @@ describe('SdeDepartmentService', () => { expect(service).toBeTruthy(); }); - it('add an organisation to the cache', () => { - const expectedOrg = { id: 'test-org-id' } as Organisation; + it('add an department to the cache', () => { + const expectedDept = { id: 'test-dept-id' } as Department; - service.addOrganisationToCache(expectedOrg); + service.addDepartmentToCache(expectedDept); - expect(service.organisations).toContain(expectedOrg); + expect(service.departments).toContain(expectedDept); }); - it('should return cached organisation data when available', () => { - const orgId = 'test-org-id'; - const expectedOrg = { id: orgId } as Organisation; + it('should return cached department data when available', () => { + const deptId = 'test-dept-id'; + const expectedDept = { id: deptId } as Department; - service.addOrganisationToCache(expectedOrg); + service.addDepartmentToCache(expectedDept); - service.get(orgId).subscribe((org) => { - expect(org).toEqual(expectedOrg); - expect(organisationEndpointsStub.getOrganisation).not.toHaveBeenCalled(); + service.get(deptId).subscribe((dept) => { + expect(dept).toEqual(expectedDept); + expect(departmentEndpointsStub.getDepartment).not.toHaveBeenCalled(); }); }); - it('should fetch organisation data when not cached and add that org to the cache', () => { - const orgId = 'test-org-id'; - const expectedOrg = { id: orgId } as Organisation; + it('should fetch department data when not cached and add that dept to the cache', () => { + const deptId = 'test-dept-id'; + const expectedDept = { id: deptId } as Department; - organisationEndpointsStub.getOrganisation.mockReturnValueOnce(of(expectedOrg)); + departmentEndpointsStub.getDepartment.mockReturnValueOnce(of(expectedDept)); - service.get(orgId).subscribe((org) => { - expect(org).toEqual(expectedOrg); - expect(service.organisations).toContain(expectedOrg); + service.get(deptId).subscribe((dept) => { + expect(dept).toEqual(expectedDept); + expect(service.departments).toContain(expectedDept); }); }); }); diff --git a/src/app/secure-data-environment/services/sde-department.service.ts b/src/app/secure-data-environment/services/sde-department.service.ts index 30edae7f..2bf0dbd3 100644 --- a/src/app/secure-data-environment/services/sde-department.service.ts +++ b/src/app/secure-data-environment/services/sde-department.service.ts @@ -19,45 +19,45 @@ SPDX-License-Identifier: Apache-2.0 import { Injectable } from '@angular/core'; import { BehaviorSubject, Observable, of, tap } from 'rxjs'; import { + Department, + DepartmentEndpoints, + UserDepartmentDTO, Uuid, - Organisation, - UserOrganisationDTO, - OrganisationEndpoints, } from '@maurodatamapper/sde-resources'; @Injectable({ providedIn: 'root', }) export class SdeDepartmentService { - private _organisations = new BehaviorSubject([]); + private _departments = new BehaviorSubject([]); - constructor(private organisationEndpoints: OrganisationEndpoints) {} + constructor(private departmentEndpoints: DepartmentEndpoints) {} - get organisations$(): Observable { - return this._organisations.asObservable(); + get departments$(): Observable { + return this._departments.asObservable(); } - get organisations(): Organisation[] { - return this._organisations.value; + get departments(): Department[] { + return this._departments.value; } - get(organisationId: Uuid): Observable { - const cachedOrg = this.organisations.find((org) => org.id === organisationId); - return cachedOrg ? of(cachedOrg) : this.fetch(organisationId); + get(departmentId: Uuid): Observable { + const cachedDept = this.departments.find((dept) => dept.id === departmentId); + return cachedDept ? of(cachedDept) : this.fetch(departmentId); } - getUsersOrganisations(): Observable { - return this.organisationEndpoints.listResearchersOrganisationMemberships(); + getUsersDepartments(): Observable { + return this.departmentEndpoints.listResearchersDepartmentMemberships(); } - addOrganisationToCache(organisation: Organisation): void { - this._organisations.next([...this.organisations, organisation]); + addDepartmentToCache(department: Department): void { + this._departments.next([...this.departments, department]); } - private fetch(organisationId: Uuid): Observable { - return this.organisationEndpoints.getOrganisation(organisationId).pipe( - tap((org: Organisation) => { - this.addOrganisationToCache(org); + private fetch(departmentId: Uuid): Observable { + return this.departmentEndpoints.getDepartment(departmentId).pipe( + tap((dept: Department) => { + this.addDepartmentToCache(dept); }) ); } diff --git a/src/app/security/catalogue-user-basic-form/catalogue-user-basic-form.component.html b/src/app/security/catalogue-user-basic-form/catalogue-user-basic-form.component.html index db0c5572..8ddb937d 100644 --- a/src/app/security/catalogue-user-basic-form/catalogue-user-basic-form.component.html +++ b/src/app/security/catalogue-user-basic-form/catalogue-user-basic-form.component.html @@ -59,9 +59,7 @@ placeholder="Enter your organisation" required /> - Organisation is required + Organisation is required.

diff --git a/src/app/security/catalogue-user-basic-form/catalogue-user-basic-form.component.spec.ts b/src/app/security/catalogue-user-basic-form/catalogue-user-basic-form.component.spec.ts index 57c48da3..1215ca25 100644 --- a/src/app/security/catalogue-user-basic-form/catalogue-user-basic-form.component.spec.ts +++ b/src/app/security/catalogue-user-basic-form/catalogue-user-basic-form.component.spec.ts @@ -19,14 +19,8 @@ SPDX-License-Identifier: Apache-2.0 import { SimpleChange } from '@angular/core'; import { MatFormField, MatLabel } from '@angular/material/form-field'; import { MockComponent, MockDirective } from 'ng-mocks'; -import { - CatalogueUser, - CatalogueUserPayload, -} from 'src/app/mauro/catalogue-user.service'; -import { - ComponentHarness, - setupTestModuleForComponent, -} from 'src/app/testing/testing.helpers'; +import { CatalogueUser, CatalogueUserPayload } from 'src/app/mauro/catalogue-user.service'; +import { ComponentHarness, setupTestModuleForComponent } from 'src/app/testing/testing.helpers'; import { CatalogueUserBasicFormComponent } from './catalogue-user-basic-form.component'; describe('CatalogueUserBasicFormComponent', () => { diff --git a/src/app/security/catalogue-user-basic-form/catalogue-user-basic-form.component.ts b/src/app/security/catalogue-user-basic-form/catalogue-user-basic-form.component.ts index 5d944500..59c6d710 100644 --- a/src/app/security/catalogue-user-basic-form/catalogue-user-basic-form.component.ts +++ b/src/app/security/catalogue-user-basic-form/catalogue-user-basic-form.component.ts @@ -16,14 +16,7 @@ limitations under the License. SPDX-License-Identifier: Apache-2.0 */ -import { - Component, - EventEmitter, - Input, - OnChanges, - Output, - SimpleChanges, -} from '@angular/core'; +import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { CatalogueUser, CatalogueUserPayload } from '../../mauro/catalogue-user.service'; diff --git a/src/app/security/catalogue-user-contact-form/catalogue-user-contact-form.component.spec.ts b/src/app/security/catalogue-user-contact-form/catalogue-user-contact-form.component.spec.ts index a70b9b5b..982aca54 100644 --- a/src/app/security/catalogue-user-contact-form/catalogue-user-contact-form.component.spec.ts +++ b/src/app/security/catalogue-user-contact-form/catalogue-user-contact-form.component.spec.ts @@ -19,14 +19,8 @@ SPDX-License-Identifier: Apache-2.0 import { SimpleChange } from '@angular/core'; import { MatFormField, MatLabel } from '@angular/material/form-field'; import { MockComponent, MockDirective } from 'ng-mocks'; -import { - CatalogueUser, - CatalogueUserContactPayload, -} from 'src/app/mauro/catalogue-user.service'; -import { - ComponentHarness, - setupTestModuleForComponent, -} from 'src/app/testing/testing.helpers'; +import { CatalogueUser, CatalogueUserContactPayload } from 'src/app/mauro/catalogue-user.service'; +import { ComponentHarness, setupTestModuleForComponent } from 'src/app/testing/testing.helpers'; import { CatalogueUserContactFormComponent } from './catalogue-user-contact-form.component'; describe('CatalogueUserContactFormComponent', () => { diff --git a/src/app/testing/stubs/sde/department-endpoints.stub.ts b/src/app/testing/stubs/sde/department-endpoints.stub.ts index ff709114..ca62022f 100644 --- a/src/app/testing/stubs/sde/department-endpoints.stub.ts +++ b/src/app/testing/stubs/sde/department-endpoints.stub.ts @@ -18,44 +18,41 @@ SPDX-License-Identifier: Apache-2.0 */ import { - Organisation, - OrganisationMember, - OrganisationMemberDTO, + Department, + DepartmentMember, + DepartmentMemberDTO, Uuid, } from '@maurodatamapper/sde-resources'; import { Observable } from 'rxjs'; -export type ListOrganisationsFn = () => Observable; -export type ListOrganisationsMockedFn = jest.MockedFunction; - -export type GetOrganisationFn = (organisationId: Uuid) => Observable; -export type GetOrganisationMockedFn = jest.MockedFunction; - -export type ListOrganisationMembersFn = ( - organisationId: Uuid -) => Observable; -export type ListOrganisationMembersMockedFn = - jest.MockedFunction; - -export type ListOrganisationApproversAndProjectPeersFn = ( - organisationId: Uuid -) => Observable; -export type ListOrganisationApproversAndProjectPeersMockedFn = - jest.MockedFunction; - -export interface SdeOrganisationEndpointsStub { - listOrganisations: ListOrganisationsMockedFn; - getOrganisation: GetOrganisationMockedFn; - listOrganisationMembers: ListOrganisationMembersMockedFn; - listOrganisationApproversAndProjectPeers: ListOrganisationApproversAndProjectPeersMockedFn; +export type ListDepartmentsFn = () => Observable; +export type ListDepartmentsMockedFn = jest.MockedFunction; + +export type GetDepartmentFn = (departmentId: Uuid) => Observable; +export type GetDepartmentMockedFn = jest.MockedFunction; + +export type ListDepartmentMembersFn = (departmentId: Uuid) => Observable; +export type ListDepartmentMembersMockedFn = jest.MockedFunction; + +export type ListDepartmentApproversAndProjectPeersFn = ( + departmentId: Uuid +) => Observable; +export type ListDepartmentApproversAndProjectPeersMockedFn = + jest.MockedFunction; + +export interface SdeDepartmentEndpointsStub { + listDepartments: ListDepartmentsMockedFn; + getDepartment: GetDepartmentMockedFn; + listDepartmentMembers: ListDepartmentMembersMockedFn; + listDepartmentApproversAndProjectPeers: ListDepartmentApproversAndProjectPeersMockedFn; } -export const createSdeOrganisationEndpointsStub = (): SdeOrganisationEndpointsStub => { +export const createSdeDepartmentEndpointsStub = (): SdeDepartmentEndpointsStub => { return { - listOrganisations: jest.fn() as ListOrganisationsMockedFn, - getOrganisation: jest.fn() as GetOrganisationMockedFn, - listOrganisationMembers: jest.fn() as ListOrganisationMembersMockedFn, - listOrganisationApproversAndProjectPeers: - jest.fn() as ListOrganisationApproversAndProjectPeersMockedFn, + listDepartments: jest.fn() as ListDepartmentsMockedFn, + getDepartment: jest.fn() as GetDepartmentMockedFn, + listDepartmentMembers: jest.fn() as ListDepartmentMembersMockedFn, + listDepartmentApproversAndProjectPeers: + jest.fn() as ListDepartmentApproversAndProjectPeersMockedFn, }; }; diff --git a/src/app/testing/stubs/sde/department-member.service.stub.ts b/src/app/testing/stubs/sde/department-member.service.stub.ts index b8e816de..30e613ce 100644 --- a/src/app/testing/stubs/sde/department-member.service.stub.ts +++ b/src/app/testing/stubs/sde/department-member.service.stub.ts @@ -17,38 +17,32 @@ limitations under the License. SPDX-License-Identifier: Apache-2.0 */ import { + DepartmentMemberDTO, + DepartmentRole, ListColumn, - OrganisationMemberDTO, - OrganisationRole, Uuid, } from '@maurodatamapper/sde-resources'; import { Observable } from 'rxjs'; -export type ListOrganisationMembersFn = ( - organisationId: Uuid -) => Observable; -export type ListOrganisationMembersMockedFn = - jest.MockedFunction; +export type ListDepartmentMembersFn = (departmentId: Uuid) => Observable; +export type ListDepartmentMembersMockedFn = jest.MockedFunction; export type GetDisplayColumnsForAdminFn = () => ListColumn[]; -export type GetDisplayColumnsForAdminMockedFn = - jest.MockedFunction; +export type GetDisplayColumnsForAdminMockedFn = jest.MockedFunction; -export type GetDisplayColumnsForResearcherFn = ( - userOrganisationRole: OrganisationRole -) => ListColumn[]; +export type GetDisplayColumnsForResearcherFn = (userDepartmentRole: DepartmentRole) => ListColumn[]; export type GetDisplayColumnsForResearcherMockedFn = jest.MockedFunction; -export interface OrganisationMemberServiceStub { - listOrganisationMembers: ListOrganisationMembersMockedFn; +export interface DepartmentMemberServiceStub { + listDepartmentMembers: ListDepartmentMembersMockedFn; getDisplayColumnsForAdmin: GetDisplayColumnsForAdminMockedFn; getDisplayColumnsForResearcher: GetDisplayColumnsForResearcherMockedFn; } -export const createOrganisationMemberServiceStub = (): OrganisationMemberServiceStub => { +export const createDepartmentMemberServiceStub = (): DepartmentMemberServiceStub => { return { - listOrganisationMembers: jest.fn() as ListOrganisationMembersMockedFn, + listDepartmentMembers: jest.fn() as ListDepartmentMembersMockedFn, getDisplayColumnsForAdmin: jest.fn() as GetDisplayColumnsForAdminMockedFn, getDisplayColumnsForResearcher: jest.fn() as GetDisplayColumnsForResearcherMockedFn, }; diff --git a/src/app/testing/stubs/sde/sde-department-service.stub.ts b/src/app/testing/stubs/sde/sde-department-service.stub.ts index 3427f98d..aca4ac37 100644 --- a/src/app/testing/stubs/sde/sde-department-service.stub.ts +++ b/src/app/testing/stubs/sde/sde-department-service.stub.ts @@ -17,36 +17,29 @@ limitations under the License. SPDX-License-Identifier: Apache-2.0 */ -import { - Organisation, - OrganisationMemberDTO, - UserOrganisationDTO, -} from '@maurodatamapper/sde-resources'; +import { Department, DepartmentMemberDTO, UserDepartmentDTO } from '@maurodatamapper/sde-resources'; import { Uuid } from '@maurodatamapper/sde-resources'; import { Observable } from 'rxjs'; -export type GetOrganisationFn = (organisationId: Uuid) => Observable; -export type GetOrganisationMockedFn = jest.MockedFunction; +export type GetDepartmentFn = (departmentId: Uuid) => Observable; +export type GetDepartmentMockedFn = jest.MockedFunction; -export type GetUsersOrganisationsFn = () => Observable; -export type GetUsersOrganisationsMockedFn = jest.MockedFunction; +export type GetUsersDepartmentsFn = () => Observable; +export type GetUsersDepartmentsMockedFn = jest.MockedFunction; -export type GetApproversForOrganisationFn = ( - organisationId: Uuid -) => Observable; -export type GetApproversForOrganisationMockedFn = - jest.MockedFunction; +export type GetApproversForDepartmentFn = (departmentId: Uuid) => Observable; +export type GetApproversForDepartmentMockedFn = jest.MockedFunction; -export interface SdeOrganisationServiceStub { - get: GetOrganisationMockedFn; - getUsersOrganisations: GetUsersOrganisationsMockedFn; - getApproversForOrganisation: GetApproversForOrganisationMockedFn; +export interface SdeDepartmentServiceStub { + get: GetDepartmentMockedFn; + getUsersDepartments: GetUsersDepartmentsMockedFn; + getApproversForDepartment: GetApproversForDepartmentMockedFn; } -export const createSdeOrganisationServiceStub = (): SdeOrganisationServiceStub => { +export const createSdeDepartmentServiceStub = (): SdeDepartmentServiceStub => { return { - get: jest.fn() as GetOrganisationMockedFn, - getUsersOrganisations: jest.fn() as GetUsersOrganisationsMockedFn, - getApproversForOrganisation: jest.fn() as GetApproversForOrganisationMockedFn, + get: jest.fn() as GetDepartmentMockedFn, + getUsersDepartments: jest.fn() as GetUsersDepartmentsMockedFn, + getApproversForDepartment: jest.fn() as GetApproversForDepartmentMockedFn, }; };