-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from daoodaba975/fix-errors-and-tu
Fix: correction of errors and unit tests
- Loading branch information
Showing
5 changed files
with
142 additions
and
27 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
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,111 @@ | ||
const regionNamesMock = [ | ||
"Dakar", | ||
"Diourbel", | ||
"Fatick", | ||
"Kaffrine", | ||
"Kaolack", | ||
"Kédougou", | ||
"Kolda", | ||
"Louga", | ||
"Matam", | ||
"Saint-Louis", | ||
"Sédhiou", | ||
"Tambacounda", | ||
"Thies", | ||
"Ziguinchor", | ||
]; | ||
|
||
const departmentsMock = [ | ||
"Dakar", | ||
"Pikine", | ||
"Guédiawaye", | ||
"Rufisque", | ||
"Keur Massar", | ||
]; | ||
|
||
const codeMock = [ | ||
"DK", | ||
"DB", | ||
"FK", | ||
"KA", | ||
"KL", | ||
"KE", | ||
"KD", | ||
"LG", | ||
"MT", | ||
"SL", | ||
"SE", | ||
"TC", | ||
"TH", | ||
"ZG", | ||
]; | ||
|
||
const languesNationalesMock = [ | ||
"Wolof", | ||
"Pular", | ||
"Sérère", | ||
"Diola", | ||
"Mandingue", | ||
"Soninké", | ||
"Bambara", | ||
]; | ||
|
||
const allDepartmentMock = [ | ||
"Dakar", | ||
"Guédiawaye", | ||
"Keur Massar", | ||
"Pikine", | ||
"Rufisque", | ||
"Bambey", | ||
"Diourbel", | ||
"Mbacké", | ||
"Fatick", | ||
"Foundiougne", | ||
"Gossas", | ||
"Birkelane", | ||
"Kaffrine", | ||
"Koungheul", | ||
"Malème-Hodar", | ||
"Guinguinéo", | ||
"Kaolack", | ||
"Nioro du Rip", | ||
"Kédougou", | ||
"Salemata", | ||
"Saraya", | ||
"Kolda", | ||
"Vélingara", | ||
"Médina Yoro Foulah", | ||
"Kébémer", | ||
"Linguère", | ||
"Louga", | ||
"Kanel", | ||
"Matam", | ||
"Ranérou-Ferlo", | ||
"Dagana", | ||
"Podor", | ||
"Saint-Louis", | ||
"Bounkiling", | ||
"Goudomp", | ||
"Sédhiou", | ||
"Bakel", | ||
"Goudiry", | ||
"Koumpentoum", | ||
"Tambacounda", | ||
"Mbour", | ||
"Thies", | ||
"Tivaouane", | ||
"Bignona", | ||
"Oussouye", | ||
"Ziguinchor", | ||
]; | ||
|
||
const arrondissementsMock = ["Dagoudane", "Thiaroye"]; | ||
|
||
module.exports = { | ||
regionNamesMock, | ||
departmentsMock, | ||
codeMock, | ||
languesNationalesMock, | ||
allDepartmentMock, | ||
arrondissementsMock, | ||
}; |
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 |
---|---|---|
@@ -1,21 +1,23 @@ | ||
const department = require("../index") | ||
const department = require("../index"); | ||
const { allDepartmentMock, arrondissementsMock } = require("../mock/galsenify.test.mock"); | ||
|
||
|
||
describe("Department testing", () => { | ||
test("receive the department", () => { | ||
const departmentName = department.allDepartments(); | ||
expect(departmentName.length).toEqual(departmentName.length); | ||
expect(departmentName).toContain("Dakar"); | ||
expect(departmentName.length).toEqual(allDepartmentMock.length); | ||
expect(departmentName).toEqual(allDepartmentMock); | ||
}); | ||
|
||
test("receive the arrondissements of passing department", () => { | ||
const arrondissements = department.arrondissements("Pikine"); | ||
expect(arrondissements.length).toBeGreaterThan(0); | ||
expect(arrondissements).toContain("Thiaroye"); | ||
expect(arrondissements.length).toEqual(arrondissementsMock.length); | ||
expect(arrondissements).toEqual(arrondissementsMock); | ||
}); | ||
|
||
test("receive the arrrondissements of passing department should fail", () => { | ||
expect(() => department.arrondissements("Yeumbeul")).toThrow(); | ||
expect(() => department.arrondissements("")).toThrow(); | ||
expect(() => department.arrondissements("Yeumbeul")).toThrow("Oups! Ce n'est pas un Département valide !"); | ||
expect(() => department.arrondissements("")).toThrow("Oups! Ce n'est pas un Département valide !"); | ||
}); | ||
|
||
}); |
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