Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apps/api/src/trust-portal/cert-badge-mapper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ describe('mapCertificationToBadgeType', () => {
).toBe('pci_dss');
});

// Regression: soc3 / pipeda / ccpa were supported by the public portal's
// original mapper. Consolidation must not drop them or affected vendors lose
// their public Trust Centre badges.
it('maps soc3 / pipeda / ccpa (restored after consolidation)', () => {
expect(mapCertificationToBadgeType('SOC 3')).toBe('soc3');
expect(mapCertificationToBadgeType('PIPEDA')).toBe('pipeda');
expect(mapCertificationToBadgeType('CCPA')).toBe('ccpa');
});

// The digits alone must not classify an unrelated identifier.
it('does not misclassify ids that merely contain the standard digits', () => {
expect(mapCertificationToBadgeType('Catalog 19001')).toBeNull();
Expand Down
7 changes: 7 additions & 0 deletions apps/api/src/trust-portal/cert-badge-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function mapCertificationToBadgeType(certType: string): string | null {
const normalized = certType.toLowerCase().replace(/[^a-z0-9]/g, '');

if (normalized.includes('soc2')) return 'soc2';
if (normalized.includes('soc3')) return 'soc3';
if (matchesIsoStandard(normalized, '27001')) return 'iso27001';
if (matchesIsoStandard(normalized, '42001')) return 'iso42001';
if (normalized.includes('gdpr')) return 'gdpr';
Expand All @@ -59,6 +60,12 @@ export function mapCertificationToBadgeType(certType: string): string | null {
return 'pci_dss';
if (normalized.includes('nen7510')) return 'nen7510';
if (matchesIsoStandard(normalized, '9001')) return 'iso9001';
// soc3 / pipeda / ccpa were supported by the public portal's original mapper
// before consolidation; keep them so those vendors don't lose their public
// Trust Centre badges. The public portal renders them via label text and the
// admin UI safely skips badge types it has no icon for.
if (normalized.includes('pipeda')) return 'pipeda';
if (normalized.includes('ccpa')) return 'ccpa';

return null;
}
Expand Down
Loading