Labelled an opportunity's ID as an OCID only when it is one

This commit is contained in:
bwilliams committed 2026-10-21 14:15:04 +01:00
1 parent 64886a2f1e
commit 43f9ef3223
3 files changed
+17 -2

No files matched your search

+6
View File
@@ -7,6 +7,7 @@ import {
latestRelease,
mergeOpportunities,
noticeSite,
uuidLabel,
} from './opportunities';
import { testOpportunity } from './testOpportunity';
@@ -96,3 +97,8 @@ test('a Find a Tender release’s page is its notice', () => {
'https://www.find-tender.service.gov.uk/notice/095868-2026',
);
});
test('an OCID is labelled as one, and other kinds of UUID as an ID', () => {
expect(uuidLabel(testOpportunity('ocds-h6vhtk-05a1b2'))).toBe('OCID');
expect(uuidLabel(testOpportunity('eusupply-uk-100114954', { uuid_type: 'eusupply' }))).toBe('ID');
});
+9
View File
@@ -83,3 +83,12 @@ const NOTICE_SITES: Record<string, NoticeSite> = {
export function noticeSite(opportunity: Opportunity): NoticeSite | undefined {
return NOTICE_SITES[opportunity.source];
}
/**
* What the opportunity's UUID is called on screen: "OCID" for an OCDS
* contracting process's id, and "ID" for the other kinds, such as
* eusupply-uk-<tender id>, which the app makes up itself.
*/
export function uuidLabel(opportunity: Opportunity): string {
return opportunity.uuid_type === 'ocid' ? 'OCID' : 'ID';
}