Skip to content

Commit

Permalink
🧪 [#4978] Add regression test for incorrect geometry summary
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-maertens committed Jan 6, 2025
1 parent 7f8fd3b commit 280aeb0
Showing 1 changed file with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ export const WithObjectsAPIRegistrationBackends = {
targetPath: ['other', 'path'],
},
],
geometryVariableKey: '',
},
},
{
Expand All @@ -301,6 +302,7 @@ export const WithObjectsAPIRegistrationBackends = {
targetPath: ['path', 'to.the', 'target'],
},
],
geometryVariableKey: '',
},
},
{
Expand Down Expand Up @@ -375,6 +377,62 @@ export const WithObjectsAPIRegistrationBackends = {
},
};

// gh-4978 regression for geometry field on empty variable
export const EmptyUserDefinedVariableWithObjectsAPIRegistration = {
args: {
registrationBackends: [
{
backend: 'objects_api',
key: 'objects_api_1',
name: 'Example Objects API reg.',
options: {
version: 2,
objectsApiGroup: 1,
objecttype: '2c77babf-a967-4057-9969-0200320d23f1',
objecttypeVersion: 2,
variablesMapping: [
{
variableKey: 'formioComponent',
targetPath: ['path', 'to.the', 'target'],
},
{
variableKey: 'userDefined',
targetPath: ['other', 'path'],
},
],
geometryVariableKey: '',
},
},
],
variables: [
// add a variable as if the user clicked "add new user defined variable"
{
form: 'http://localhost:8000/api/v2/forms/36612390',
formDefinition: undefined,
name: '',
key: '',
source: 'user_defined',
prefillPlugin: '',
prefillAttribute: '',
prefillIdentifierRole: 'main',
dataType: 'string',
dataFormat: undefined,
isSensitiveData: false,
serviceFetchConfiguration: undefined,
initialValue: '',
prefillOptions: {},
},
],
},
play: async ({canvasElement}) => {
const canvas = within(canvasElement);

const userDefinedVarsTab = canvas.getByRole('tab', {name: 'Gebruikersvariabelen'});
await userEvent.click(userDefinedVarsTab);
expect(canvas.queryAllByText('record.geometry')).toHaveLength(0);
},
};

export const FilesMappingAndObjectAPIRegistration = {
args: {
registrationBackends: [
Expand Down

0 comments on commit 280aeb0

Please sign in to comment.