Skip to content

Commit e817092

Browse files
committed
fix(frontend): update unit test mocks
1 parent 38b1853 commit e817092

File tree

66 files changed

+250
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+250
-168
lines changed

packages/common/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ export * from "./_core";
33
export * from "./import";
44
export * from "./interactions";
55
export * from "./message-sms";
6-
export * from "./mocks";
76
export * from "./pagination";
87
export * from "./stats";
98
export * from "./structure";

packages/common/src/mocks/USAGER_ACTIF.mock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ETAPE_DOSSIER_COMPLET } from "../usager";
22

3-
export const USAGER_ACTIF_MOCK = {
3+
export const USAGER_VALIDE_MOCK = {
44
numeroDistribution: null,
55
decision: {
66
statut: "VALIDE",

packages/common/src/usager/functions/getRdvInfos.service.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { USAGER_ACTIF_MOCK } from "../../mocks";
1+
import { USAGER_VALIDE_MOCK } from "../../mocks";
22
import {
33
ETAPE_RENDEZ_VOUS,
44
ETAPE_DOSSIER_COMPLET,
@@ -68,7 +68,7 @@ describe("Création des rendez-vous", () => {
6868
});
6969

7070
it("Rendez-vous de base", () => {
71-
const usager = USAGER_ACTIF_MOCK;
71+
const usager = USAGER_VALIDE_MOCK;
7272
usager.rdv = { dateRdv: null, userId: 0, userName: "" };
7373
expect(getRdvInfos(usager)).toEqual({
7474
class: "",

packages/frontend/src/_common/mocks/USAGER_ACTIF.mock.ts renamed to packages/frontend/src/_common/mocks/USAGER_VALIDE.mock.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { CountryISO } from "@khazii/ngx-intl-tel-input";
22
import { UsagerLight } from "../model";
33
import { ETAPE_DOSSIER_COMPLET } from "@domifa/common";
44

5-
export const USAGER_ACTIF_MOCK: UsagerLight = {
5+
export const USAGER_VALIDE_MOCK: UsagerLight = {
66
numeroDistribution: null,
77
statut: "VALIDE",
88
decision: {
@@ -20,7 +20,7 @@ export const USAGER_ACTIF_MOCK: UsagerLight = {
2020
userName: "Testeur Robin",
2121
},
2222
lastInteraction: {
23-
colisIn: 0,
23+
colisIn: 10,
2424
courrierIn: 0,
2525
enAttente: false,
2626
recommandeIn: 0,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @index('./*', f => `export * from '${f.path}'`)
22
export * from "./AuthServiceMock";
33
export * from "./STRUCTURE_MOCK.const";
4-
export * from "./USAGER_ACTIF.mock";
4+
export * from "./USAGER_VALIDE.mock";
55
export * from "./USAGER_NOTE.mock";
66
export * from "./USAGER_REFUS.mock";
77
export * from "./USER_STRUCTURE.mock";

packages/frontend/src/app/modules/manage-usagers/components/column-informations/column-informations.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { UsagerFormModel } from "./../../../usager-shared/interfaces/UsagerFormM
22
import { ComponentFixture, TestBed } from "@angular/core/testing";
33

44
import { ColumnInformationsComponent } from "./column-informations.component";
5-
import { USAGER_ACTIF_MOCK } from "../../../../../_common/mocks";
5+
import { USAGER_VALIDE_MOCK } from "../../../../../_common/mocks";
66
import { APP_BASE_HREF } from "@angular/common";
77
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
88
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
@@ -22,7 +22,7 @@ describe("ColumnInformationsComponent", () => {
2222

2323
fixture = TestBed.createComponent(ColumnInformationsComponent);
2424
component = fixture.componentInstance;
25-
component.usager = new UsagerFormModel(USAGER_ACTIF_MOCK);
25+
component.usager = new UsagerFormModel(USAGER_VALIDE_MOCK);
2626
fixture.detectChanges();
2727
});
2828

packages/frontend/src/app/modules/manage-usagers/components/manage-download-docs/manage-download-docs.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { HttpClientTestingModule } from "@angular/common/http/testing";
22
import { ComponentFixture, TestBed } from "@angular/core/testing";
33
import {
4-
USAGER_ACTIF_MOCK,
4+
USAGER_VALIDE_MOCK,
55
USER_STRUCTURE_MOCK,
66
} from "../../../../../_common/mocks";
77
import { UsagerFormModel } from "../../../usager-shared/interfaces";
@@ -29,7 +29,7 @@ describe("ManageDownloadDocsComponent", () => {
2929
component = fixture.componentInstance;
3030
component.me = USER_STRUCTURE_MOCK;
3131
component.me.structure = USER_STRUCTURE_MOCK.structure;
32-
component.usager = new UsagerFormModel(USAGER_ACTIF_MOCK);
32+
component.usager = new UsagerFormModel(USAGER_VALIDE_MOCK);
3333
fixture.detectChanges();
3434
});
3535

packages/frontend/src/app/modules/manage-usagers/components/manage-usagers-page/manage-usagers-page.component.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,11 @@ export class ManageUsagersPageComponent implements OnInit, OnDestroy {
259259
usagers: UsagerLight[],
260260
usagersRadiesTotalCount: number
261261
) {
262-
this.usagersCountByStatus = calculateUsagersCountByStatus(usagers);
263-
this.usagersCountByStatus.RADIE = usagersRadiesTotalCount;
264-
this.usagersCountByStatus.TOUS = usagers.length;
262+
this.usagersCountByStatus = calculateUsagersCountByStatus(
263+
usagers,
264+
usagersRadiesTotalCount
265+
);
266+
265267
this.usagersRadiesLoadedCount = usagers.filter(
266268
(usager) => usager.statut === "RADIE"
267269
).length;

packages/frontend/src/app/modules/manage-usagers/components/manage-usagers-table/manage-usagers-table.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@
157157
</label>
158158
</td>
159159
<td *ngIf="filters.statut === 'TOUS'" class="clickable text-start">
160-
<span [class]="'label-info ' + usager?.statusInfos?.color">
161-
{{ usager?.statusInfos?.text }}</span
160+
<span [class]="'label-info ' + usager?.statusInfo?.color">
161+
{{ usager?.statusInfo?.text }}</span
162162
>
163163
</td>
164164
<td

packages/frontend/src/app/modules/manage-usagers/components/usager-filter/services/calculateUsagersCountByStatus.service.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import { UsagersCountByStatus } from "..";
22
import { UsagerLight } from "../../../../../../_common/model";
33

44
export function calculateUsagersCountByStatus(
5-
usagers: UsagerLight[]
5+
usagers: UsagerLight[],
6+
usagersRadiesTotalCount: number
67
): UsagersCountByStatus {
7-
return usagers.reduce(
8+
const counters = usagers.reduce(
89
(count, usager) => {
910
// We skip "RADIE" already count by backend
1011
if (usager.statut !== "RADIE") {
1112
count[usager.statut]++;
13+
count.TOUS++;
1214
}
1315
return count;
1416
},
@@ -21,4 +23,7 @@ export function calculateUsagersCountByStatus(
2123
TOUS: 0,
2224
}
2325
);
26+
counters.TOUS = counters.TOUS + usagersRadiesTotalCount;
27+
counters.RADIE = usagersRadiesTotalCount;
28+
return counters;
2429
}

0 commit comments

Comments
 (0)