Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

Commit 7646934

Browse files
authored
Return the value of the update (#875)
1 parent b7684ce commit 7646934

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/repositories/jobRepository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class JobRepository extends BaseRepository {
4646
if (shouldNotifySqs) {
4747
await this.notify(objectId.toString(), c.get('jobUpdatesQueueUrl'), JobStatus.completed, 0);
4848
}
49-
return updateResponse;
49+
return updateResponse.value;
5050
}
5151

5252
async insertJob(job: Omit<Job | EnhancedJob, '_id'>, url: string): Promise<string> {

tests/unit/repositories/jobRepository.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ describe('Job Repository Tests', () => {
200200
}
201201

202202
function setupForFindOneAndUpdateSuccess() {
203-
dbRepoHelper.collection.findOneAndUpdate.mockReturnValueOnce(job);
203+
dbRepoHelper.collection.findOneAndUpdate.mockReturnValueOnce({ value: job });
204204
jest.spyOn(jobRepo, 'notify').mockResolvedValueOnce(true);
205205
dbRepoHelper.config.get.calledWith('MONGO_TIMEOUT_S').mockReturnValueOnce(1);
206206
}

0 commit comments

Comments
 (0)