-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 1304-remove-redis
Signed-off-by: Xavier Jp <xavier.jouppe@beta.gouv.fr>
- Loading branch information
Showing
12 changed files
with
78 additions
and
33 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
19 changes: 0 additions & 19 deletions
19
components/labels-and-certificates/rge/map-certicat-to-logo.tsx
This file was deleted.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
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,26 @@ | ||
import { getCertificatLogoPath } from './certificats-logo'; | ||
|
||
describe('CertificatLogo works', () => { | ||
test('valid certificatss names', () => { | ||
expect(getCertificatLogoPath('qualifelec +')).toBe( | ||
'/images/rge/logo-rge-qualifelec.jpg' | ||
); | ||
expect(getCertificatLogoPath('qualipv')).toBe( | ||
'/images/rge/logo-rge-qualiPV.jpg' | ||
); | ||
expect(getCertificatLogoPath('chauffage +')).toBe( | ||
'/images/rge/logo-rge-chauffage.jpg' | ||
); | ||
expect(getCertificatLogoPath('habitat')).toBe( | ||
'/images/rge/logo-rge-NF.jpg' | ||
); | ||
}); | ||
|
||
test('Invalids certificates names', () => { | ||
expect(getCertificatLogoPath('quali')).toBe(''); | ||
expect(getCertificatLogoPath('3456')).toBe(''); | ||
expect(getCertificatLogoPath('chauffage+')).toBe(''); | ||
}); | ||
}); | ||
|
||
export {}; |
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,29 @@ | ||
const certificatsLogo = { | ||
qualibat: 'qualibat.jpg', | ||
qualifelec: 'qualifelec.jpg', | ||
qualipac: 'qualiPAC.jpg', | ||
qualibois: 'qualiBois.jpg', | ||
opqibi: 'opqibi.jpg', | ||
'chauffage +': 'chauffage.jpg', | ||
qualipv: 'qualiPV.jpg', | ||
ventilation: 'ventillation.jpg', | ||
qualisol: 'qualisol.jpg', | ||
certibat: 'certibat.jpg', | ||
habitat: 'NF.jpg', | ||
qualiforage: 'aualiForage.jpg', | ||
}; | ||
|
||
/** | ||
* match logo path on partial certificats names as several certificates share the same logo | ||
* | ||
* eg : "Qualibois module Air" and "Qualibois module Eau" => QualiBois.jpg | ||
* */ | ||
|
||
export const getCertificatLogoPath = (nomCertificat: string) => { | ||
for (let [certificateSub, path] of Object.entries(certificatsLogo)) { | ||
if ((nomCertificat || '').toLowerCase().indexOf(certificateSub) !== -1) { | ||
return `/images/rge/logo-rge-${path}` || ''; | ||
} | ||
} | ||
return ''; | ||
}; |