Skip to content
Snippets Groups Projects
Commit 98084c73 authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

add missing à and ö

parent 9cb0ae79
No related branches found
No related tags found
1 merge request!38fix(insee): add missing à and ö
Pipeline #55094 passed
......@@ -75,6 +75,12 @@ describe('getInseeCode', () => {
expect(await getInseeCode('69530', 'Brignais')).toEqual('69027')
})
it('should return insee code for: Saint-Christophe-à-Berry', async () => {
expect(await getInseeCode('02290', 'Saint-Christophe-à-Berry')).toEqual(
'02673'
)
})
describe('should handle communes with "Saint" or "St"', () => {
it("should return insee code for: Saint Romain au Mont d'Or", async () => {
expect(await getInseeCode(69270, "Saint Romain au Mont d'Or")).toEqual(
......
......@@ -52,7 +52,7 @@ function sanitizeCity(city) {
return city
.toLowerCase()
.replace(/\bst\b/i, 'saint')
.replace(/[âêîôûäëïü-\sʼ'’éèç]/g, match => REPLACE_CHARS[match])
.replace(/[âêîôûäëïöü-\sʼ'’éàèç]/g, match => REPLACE_CHARS[match])
.trim()
}
......@@ -73,6 +73,7 @@ const REPLACE_CHARS = {
"'": '',
'': '',
é: 'e',
à: 'a',
è: 'e',
ç: 'c',
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment