Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const mockSchemas = {
default: 'Adapter.Full.Type.Mock',
},
},
required: ['exampleName'],
},
},
},
Expand Down Expand Up @@ -150,6 +151,21 @@ describe('ExternalAdapterSettings', () => {
});
});

it('does not proceed if required settings are missing', async () => {
const { getByTestId } = renderWithRecoilAndCustomDispatchers(
<ExternalAdapterSettings projectId={PROJECT_ID} />,
initRecoilState
);
const container = getByTestId('adapterSettings');
const configureButton = within(container).queryAllByText('Configure')[0];
act(() => {
fireEvent.click(configureButton);
});

const modal = getByTestId('adapterModal');
expect(within(modal).getByText('Configure')).toBeDisabled();
});

it('disables an adapter', async () => {
const initStateWithAdapter = {
runtimeSettings: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type Props = {

export function hasRequired(testObject: { [key: string]: JSONSchema7Type | undefined }, fields?: string[]) {
if (fields == null || fields.length === 0) return true;
return fields.every((field: string) => field in testObject);
return fields.every((field: string) => field in testObject && testObject[field] != null);
}

function makeDefault(schema: JSONSchema7) {
Expand Down