Skip to content

Commit

Permalink
Merge pull request #648 from HDRUK/hotfix/GAT-607-SUPP-805
Browse files Browse the repository at this point in the history
hotfix/GAT-607-SUPP-805
  • Loading branch information
pawilliams-hdr authored Jan 25, 2022
2 parents 004244c + 48f5a1b commit 876deb3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe('DataUseRegisterService', function () {

const updateObj = await dataUseRegisterService.buildUpdateObject(dataUserRegister, dataUseRegisterPayload, user);

const expectedResponse = { relatedObjects: [], activeflag: 'active', rejectionReason: '' };
const expectedResponse = { activeflag: 'active', rejectionReason: '' };

expect(updateObj).toEqual(expectedResponse);
});
Expand All @@ -91,7 +91,7 @@ describe('DataUseRegisterService', function () {

const updateObj = await dataUseRegisterService.buildUpdateObject(dataUserRegister, dataUseRegisterPayload, user);

const expectedResponse = { relatedObjects: [], activeflag: 'rejected', rejectionReason: 'This dataset is rejected' };
const expectedResponse = { activeflag: 'rejected', rejectionReason: 'This dataset is rejected' };

expect(updateObj).toEqual(expectedResponse);
});
Expand All @@ -103,7 +103,7 @@ describe('DataUseRegisterService', function () {

const updateObj = await dataUseRegisterService.buildUpdateObject(dataUserRegister, dataUseRegisterPayload, user);

const expectedResponse = { relatedObjects: [], activeflag: 'archived', rejectionReason: '' };
const expectedResponse = { activeflag: 'archived', rejectionReason: '' };

expect(updateObj).toEqual(expectedResponse);
});
Expand Down
4 changes: 3 additions & 1 deletion src/resources/dataUseRegister/dataUseRegister.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,9 @@ export default class DataUseRegisterService {

//relatedObjects

updateObj.relatedObjects = [...relatedResourcesWithRemovedOldAutomaticEntries, ...newAutomaticRelatedResources];
if (relatedObjects) {
updateObj.relatedObjects = [...relatedResourcesWithRemovedOldAutomaticEntries, ...newAutomaticRelatedResources];
}

const fundersAndSponsorsList =
fundersAndSponsors &&
Expand Down

0 comments on commit 876deb3

Please sign in to comment.