-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
152 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
apiv2/src/admin/core/sejours/phase1/affectation/Affectation.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { Test, TestingModule } from "@nestjs/testing"; | ||
import { Logger } from "@nestjs/common"; | ||
|
||
import { FileGateway } from "@shared/core/File.gateway"; | ||
import { TaskGateway } from "@task/core/Task.gateway"; | ||
|
||
import { PointDeRassemblementGateway } from "../pointDeRassemblement/PointDeRassemblement.gateway"; | ||
import { AffectationService } from "./Affectation.service"; | ||
import { SessionGateway } from "../session/Session.gateway"; | ||
import { JeuneGateway } from "../../jeune/Jeune.gateway"; | ||
import { LigneDeBusGateway } from "../ligneDeBus/LigneDeBus.gateway"; | ||
import { SejourGateway } from "../sejour/Sejour.gateway"; | ||
import { CentreGateway } from "../centre/Centre.gateway"; | ||
import { PlanDeTransportGateway } from "../PlanDeTransport/PlanDeTransport.gateway"; | ||
|
||
describe("AffectationService", () => { | ||
let affectationService: AffectationService; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [ | ||
AffectationService, | ||
Logger, | ||
{ | ||
provide: TaskGateway, | ||
useValue: {}, | ||
}, | ||
{ | ||
provide: SessionGateway, | ||
useValue: {}, | ||
}, | ||
{ | ||
provide: JeuneGateway, | ||
useValue: {}, | ||
}, | ||
{ | ||
provide: LigneDeBusGateway, | ||
useValue: {}, | ||
}, | ||
{ | ||
provide: PointDeRassemblementGateway, | ||
useValue: {}, | ||
}, | ||
{ | ||
provide: SejourGateway, | ||
useValue: {}, | ||
}, | ||
{ | ||
provide: CentreGateway, | ||
useValue: {}, | ||
}, | ||
{ | ||
provide: PlanDeTransportGateway, | ||
useValue: {}, | ||
}, | ||
], | ||
}).compile(); | ||
|
||
affectationService = module.get<AffectationService>(AffectationService); | ||
}); | ||
|
||
it("should correctly format the percentage", () => { | ||
expect(affectationService.formatPourcent(0.5)).toBe("50.00%"); | ||
expect(affectationService.formatPourcent(0.1234)).toBe("12.34%"); | ||
expect(affectationService.formatPourcent(0)).toBe("0.00%"); | ||
expect(affectationService.formatPourcent(1)).toBe("100.00%"); | ||
expect(affectationService.formatPourcent(null as any)).toBe(""); | ||
expect(affectationService.formatPourcent(undefined as any)).toBe(""); | ||
expect(affectationService.formatPourcent(NaN)).toBe(""); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters