diff --git a/src/process/validation/rules/__tests__/validateAvailableItems.test.ts b/src/process/validation/rules/__tests__/validateAvailableItems.test.ts index 4b530d88..63b6a904 100644 --- a/src/process/validation/rules/__tests__/validateAvailableItems.test.ts +++ b/src/process/validation/rules/__tests__/validateAvailableItems.test.ts @@ -476,7 +476,11 @@ describe('validateAvailableItems', function () { context.fetch = () => { return Promise.resolve({ ok: true, - json: () => Promise.resolve(['1', '2', '3']), + json: () => Promise.resolve([ + { label: '1', value: '1' }, + { label: '2', value: '2' }, + { label: '3', value: '3' }, + ]), }); }; const result = await validateAvailableItems(context); @@ -501,7 +505,11 @@ describe('validateAvailableItems', function () { context.fetch = () => { return Promise.resolve({ ok: true, - json: () => Promise.resolve(['1', '2', '3']), + json: () => Promise.resolve([ + { label: '1', value: '1' }, + { label: '2', value: '2' }, + { label: '3', value: '3' }, + ]), }); }; const result = await validateAvailableItems(context); diff --git a/src/process/validation/rules/validateAvailableItems.ts b/src/process/validation/rules/validateAvailableItems.ts index e0db8496..7e37ffed 100644 --- a/src/process/validation/rules/validateAvailableItems.ts +++ b/src/process/validation/rules/validateAvailableItems.ts @@ -249,7 +249,10 @@ export const validateAvailableItems: RuleFn = async (context: ValidationContext) ? null : error; } - return values.find((optionValue) => optionValue === value) !== undefined ? null : error; + return values.find((optionValue) => optionValue.value === value || optionValue === value) !== + undefined + ? null + : error; } return null;