-
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.
fix(lib): vérification des objectifs pour les jeunes résidant à l'étr…
…anger
- Loading branch information
Showing
3 changed files
with
55 additions
and
12 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
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,38 @@ | ||
import { getDepartmentForEligibility } from "./region-and-departments"; | ||
|
||
describe("getDepartmentForEligibility", () => { | ||
it("returns the school department if the young person is schooled", () => { | ||
const young = { _id: "123", schooled: "true", schoolDepartment: "TestDepartment" }; | ||
expect(getDepartmentForEligibility(young)).toBe("TestDepartment"); | ||
}); | ||
|
||
it("returns the department if the young person is not schooled", () => { | ||
const young = { _id: "123", schooled: "false", department: "TestDepartment" }; | ||
expect(getDepartmentForEligibility(young)).toBe("TestDepartment"); | ||
}); | ||
|
||
it("returns the school department if both are available and the young person is schooled", () => { | ||
const young = { _id: "123", schooled: "true", schoolDepartment: "SchoolDepartment", department: "Department" }; | ||
expect(getDepartmentForEligibility(young)).toBe("SchoolDepartment"); | ||
}); | ||
|
||
it("returns the school department if both are available", () => { | ||
const young = { _id: "123", schoolDepartment: "SchoolDepartment", department: "Department" }; | ||
expect(getDepartmentForEligibility(young)).toBe("SchoolDepartment"); | ||
}); | ||
|
||
it("returns department when schoolCountry is not FRANCE", () => { | ||
const young = { _id: "123", department: "youngDepartment", schoolCountry: "ESPAGNE", schoolDepartment: "134" }; | ||
expect(getDepartmentForEligibility(young)).toBe("youngDepartment"); | ||
}); | ||
|
||
it('returns "Etranger" if no department is found', () => { | ||
const young = { _id: "123", schooled: "false" }; | ||
expect(getDepartmentForEligibility(young)).toBe("Etranger"); | ||
}); | ||
|
||
it("when department prepended with 0 should return good department", () => { | ||
const young = { _id: "123", department: "044" }; | ||
expect(getDepartmentForEligibility(young)).toBe("Loire-Atlantique"); | ||
}); | ||
}); |
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