diff options
Diffstat (limited to 'spec/frontend/import_entities/import_groups/graphql')
3 files changed, 36 insertions, 8 deletions
diff --git a/spec/frontend/import_entities/import_groups/graphql/client_factory_spec.js b/spec/frontend/import_entities/import_groups/graphql/client_factory_spec.js index ec50dfd037f..e1d65095888 100644 --- a/spec/frontend/import_entities/import_groups/graphql/client_factory_spec.js +++ b/spec/frontend/import_entities/import_groups/graphql/client_factory_spec.js @@ -259,6 +259,10 @@ describe('Bulk import resolvers', () => { target_namespace: 'root', new_name: 'group1', }, + last_import_target: { + target_namespace: 'root', + new_name: 'group1', + }, validation_errors: [], }, ], @@ -414,19 +418,32 @@ describe('Bulk import resolvers', () => { }); }); - it('setImportProgress updates group progress', async () => { + it('setImportProgress updates group progress and sets import target', async () => { const NEW_STATUS = 'dummy'; const FAKE_JOB_ID = 5; + const IMPORT_TARGET = { + __typename: 'ClientBulkImportTarget', + new_name: 'fake_name', + target_namespace: 'fake_target', + }; const { data: { - setImportProgress: { progress }, + setImportProgress: { progress, last_import_target: lastImportTarget }, }, } = await client.mutate({ mutation: setImportProgressMutation, - variables: { sourceGroupId: GROUP_ID, status: NEW_STATUS, jobId: FAKE_JOB_ID }, + variables: { + sourceGroupId: GROUP_ID, + status: NEW_STATUS, + jobId: FAKE_JOB_ID, + importTarget: IMPORT_TARGET, + }, }); - expect(progress).toMatchObject({ + expect(lastImportTarget).toStrictEqual(IMPORT_TARGET); + + expect(progress).toStrictEqual({ + __typename: clientTypenames.BulkImportProgress, id: FAKE_JOB_ID, status: NEW_STATUS, }); @@ -442,7 +459,8 @@ describe('Bulk import resolvers', () => { variables: { id: FAKE_JOB_ID, status: NEW_STATUS }, }); - expect(statusInResponse).toMatchObject({ + expect(statusInResponse).toStrictEqual({ + __typename: clientTypenames.BulkImportProgress, id: FAKE_JOB_ID, status: NEW_STATUS, }); @@ -460,7 +478,13 @@ describe('Bulk import resolvers', () => { variables: { sourceGroupId: GROUP_ID, field: FAKE_FIELD, message: FAKE_MESSAGE }, }); - expect(validationErrors).toMatchObject([{ field: FAKE_FIELD, message: FAKE_MESSAGE }]); + expect(validationErrors).toStrictEqual([ + { + __typename: clientTypenames.BulkImportValidationError, + field: FAKE_FIELD, + message: FAKE_MESSAGE, + }, + ]); }); it('removeValidationError removes error from group', async () => { @@ -481,7 +505,7 @@ describe('Bulk import resolvers', () => { variables: { sourceGroupId: GROUP_ID, field: FAKE_FIELD }, }); - expect(validationErrors).toMatchObject([]); + expect(validationErrors).toStrictEqual([]); }); }); }); diff --git a/spec/frontend/import_entities/import_groups/graphql/fixtures.js b/spec/frontend/import_entities/import_groups/graphql/fixtures.js index 6f66066b312..d1bd52693b6 100644 --- a/spec/frontend/import_entities/import_groups/graphql/fixtures.js +++ b/spec/frontend/import_entities/import_groups/graphql/fixtures.js @@ -9,6 +9,10 @@ export const generateFakeEntry = ({ id, status, ...rest }) => ({ target_namespace: 'root', new_name: `group${id}`, }, + last_import_target: { + target_namespace: 'root', + new_name: `last-group${id}`, + }, id, progress: { id: `test-${id}`, diff --git a/spec/frontend/import_entities/import_groups/graphql/services/source_groups_manager_spec.js b/spec/frontend/import_entities/import_groups/graphql/services/source_groups_manager_spec.js index bae715edac0..f06babcb149 100644 --- a/spec/frontend/import_entities/import_groups/graphql/services/source_groups_manager_spec.js +++ b/spec/frontend/import_entities/import_groups/graphql/services/source_groups_manager_spec.js @@ -20,7 +20,7 @@ describe('SourceGroupsManager', () => { describe('storage management', () => { const IMPORT_ID = 1; - const IMPORT_TARGET = { destination_name: 'demo', destination_namespace: 'foo' }; + const IMPORT_TARGET = { new_name: 'demo', target_namespace: 'foo' }; const STATUS = 'FAKE_STATUS'; const FAKE_GROUP = { id: 1, import_target: IMPORT_TARGET, status: STATUS }; |