Skip to content

Commit

Permalink
Merge pull request #169 from open-formulieren/iot-changes
Browse files Browse the repository at this point in the history
[open-formulieren/open-forms#4267] Take new IOT API endpoint into account
  • Loading branch information
Viicos authored Jul 18, 2024
2 parents 6878ad5 + b5dc137 commit e84352d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 41 deletions.
10 changes: 3 additions & 7 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@ export interface SelectOption {
*/
export interface DocumentTypeOption {
backendLabel: string;
catalogus: {
domein: string;
};
informatieobjecttype: {
url: string;
omschrijving: string;
};
catalogusLabel: string;
url: string;
omschrijving: string;
}

/*
Expand Down
6 changes: 3 additions & 3 deletions src/registry/file/registration-tab.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export const DocumentTypes: Story = {
await userEvent.keyboard('[ArrowDown]');

await step('Option group labels', async () => {
expect(await canvas.findByText('VTH', {exact: true})).toBeVisible();
expect(canvas.getByText('Open Zaak > VTH', {exact: true})).toBeVisible();
expect(canvas.getByText('Open Zaak > SOC', {exact: true})).toBeVisible();
expect(await canvas.findByText('VTH (RSIN: 000000000)', {exact: true})).toBeVisible();
expect(canvas.getByText('Open Zaak > VTH (RSIN: 000000000)', {exact: true})).toBeVisible();
expect(canvas.getByText('Open Zaak > Test catalogus name', {exact: true})).toBeVisible();
});

await step('Option labels', async () => {
Expand Down
6 changes: 3 additions & 3 deletions src/registry/file/registration-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ interface DocumentTypeOptionsGroup {

const groupDocumentTypeOptions = (options: DocumentTypeOption[]): DocumentTypeOptionsGroup[] => {
const optionsWithGroupLabel = options.map(item => {
const groupLabel = [item.backendLabel, item.catalogus.domein].filter(Boolean).join(' > ');
const groupLabel = [item.backendLabel, item.catalogusLabel].filter(Boolean).join(' > ');
return {
groupLabel,
value: item.informatieobjecttype.url,
label: item.informatieobjecttype.omschrijving,
value: item.url,
label: item.omschrijving,
};
});

Expand Down
41 changes: 13 additions & 28 deletions src/tests/sharedUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,43 +125,28 @@ export const DEFAULT_FILE_TYPES: SelectOption[] = [
export const DEFAULT_DOCUMENT_TYPES: DocumentTypeOption[] = [
{
backendLabel: '',
catalogus: {
domein: 'VTH',
},
informatieobjecttype: {
url: 'https://example.com/iotype/123',
omschrijving: 'Vergunning',
},
catalogusLabel: 'VTH (RSIN: 000000000)',
url: 'https://example.com/iotype/123',
omschrijving: 'Vergunning',
},
{
backendLabel: 'Open Zaak',
catalogus: {
domein: 'VTH',
},
informatieobjecttype: {
url: 'https://example.com/iotype/456',
omschrijving: 'Vergunning',
},
catalogusLabel: 'VTH (RSIN: 000000000)',

url: 'https://example.com/iotype/456',
omschrijving: 'Vergunning',
},
{
backendLabel: 'Open Zaak',
catalogus: {
domein: 'VTH',
},
informatieobjecttype: {
url: 'https://example.com/iotype/789',
omschrijving: 'Ontheffing',
},
catalogusLabel: 'VTH (RSIN: 000000000)',
url: 'https://example.com/iotype/789',
omschrijving: 'Ontheffing',
},
{
backendLabel: 'Open Zaak',
catalogus: {
domein: 'SOC',
},
informatieobjecttype: {
url: 'https://example.com/iotype/abc',
omschrijving: 'Aanvraag',
},
catalogusLabel: 'Test catalogus name',
url: 'https://example.com/iotype/abc',
omschrijving: 'Aanvraag',
},
];

Expand Down
2 changes: 2 additions & 0 deletions src/tests/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const contextRender = (
uniquifyKey: key => key,
supportedLanguageCodes: builderOptions.supportedLanguageCodes || ['nl', 'en'],
richTextColors: DEFAULT_COLORS,
theme: 'light',
getFormComponents: () => builderOptions.componentTree || DEFAULT_COMPONENT_TREE,
getValidatorPlugins: async () => {
await sleep(builderOptions.registrationAttributesDelay || 0);
Expand Down Expand Up @@ -160,6 +161,7 @@ const dummyBuilderContext = {
uniquifyKey: (key: string) => key,
supportedLanguageCodes: ['nl', 'en'],
richTextColors: [],
theme: 'light',
getFormComponents: () => [],
getValidatorPlugins: async () => [],
getRegistrationAttributes: async () => [],
Expand Down

0 comments on commit e84352d

Please sign in to comment.