Skip to content

Commit

Permalink
Return Owner with Corporate Summary on Save/Updated
Browse files Browse the repository at this point in the history
Looks like Application / NOI now work differently and Application uses the returned owner. The returned owner was not being loaded with their corporate summary resulting in it showing as Not Applicable.
  • Loading branch information
Daniel Haselhan committed May 29, 2024
1 parent 075a9bf commit 65781ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ describe('ApplicationOwnerService', () => {

it('should load the type and then call save for create', async () => {
mockRepo.save.mockResolvedValue(new ApplicationOwner());
mockRepo.findOneOrFail.mockResolvedValue(new ApplicationOwner());
mockTypeRepo.findOneOrFail.mockResolvedValue(new OwnerType());

await service.create(
Expand All @@ -103,6 +104,7 @@ describe('ApplicationOwnerService', () => {
);

expect(mockRepo.save).toHaveBeenCalledTimes(1);
expect(mockRepo.findOneOrFail).toHaveBeenCalledTimes(1);
expect(mockTypeRepo.findOneOrFail).toHaveBeenCalledTimes(1);
});

Expand Down Expand Up @@ -159,7 +161,7 @@ describe('ApplicationOwnerService', () => {

expect(owner.firstName).toEqual('I Am');
expect(owner.lastName).toEqual('Batman');
expect(mockRepo.findOneOrFail).toHaveBeenCalledTimes(1);
expect(mockRepo.findOneOrFail).toHaveBeenCalledTimes(2);
expect(mockRepo.save).toHaveBeenCalledTimes(1);
});

Expand All @@ -186,7 +188,7 @@ describe('ApplicationOwnerService', () => {

expect(owner.corporateSummary).toBe(mockDocument);
expect(mockAppDocumentService.delete).toHaveBeenCalledTimes(1);
expect(mockRepo.findOneOrFail).toHaveBeenCalledTimes(1);
expect(mockRepo.findOneOrFail).toHaveBeenCalledTimes(2);
expect(mockRepo.save).toHaveBeenCalledTimes(1);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export class ApplicationOwnerService {
type,
});

return await this.repository.save(newOwner);
const res = await this.repository.save(newOwner);
return this.getOwner(res.uuid);
}

async attachToParcel(uuid: string, parcelUuid: string) {
Expand Down Expand Up @@ -198,7 +199,7 @@ export class ApplicationOwnerService {
existingOwner.applicationSubmissionUuid,
);

return result;
return this.getOwner(result.uuid);
}

async delete(owner: ApplicationOwner) {
Expand Down

0 comments on commit 65781ce

Please sign in to comment.