Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Reputation Oracle][Recording Oracle] Change event type task_completed to job_completed #2564

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export enum EventType {
ESCROW_COMPLETED = 'escrow_completed',
TASK_COMPLETED = 'task_completed',
JOB_COMPLETED = 'job_completed',
SUBMISSION_REJECTED = 'submission_rejected',
SUBMISSION_IN_REVIEW = 'submission_in_review',
}
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ describe('JobService', () => {
const expectedBody = {
chain_id: jobSolution.chainId,
escrow_address: jobSolution.escrowAddress,
event_type: EventType.TASK_COMPLETED,
event_type: EventType.JOB_COMPLETED,
};
expect(result).toEqual('The requested job is completed.');
expect(httpServicePostMock).toHaveBeenCalledWith(
Expand Down Expand Up @@ -577,7 +577,7 @@ describe('JobService', () => {
const expectedBody = {
chain_id: jobSolution.chainId,
escrow_address: jobSolution.escrowAddress,
event_type: EventType.TASK_COMPLETED,
event_type: EventType.JOB_COMPLETED,
};
expect(result).toEqual('The requested job is completed.');
expect(httpServicePostMock).toHaveBeenCalledWith(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class JobService {
{
chainId: webhook.chainId,
escrowAddress: webhook.escrowAddress,
eventType: EventType.TASK_COMPLETED,
eventType: EventType.JOB_COMPLETED,
},
this.web3ConfigService.privateKey,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ describe('webhookController', () => {
const webhook: WebhookDto = {
chainId,
escrowAddress,
eventType: EventType.TASK_COMPLETED,
eventType: EventType.JOB_COMPLETED,
};
jest.spyOn(webhookService, 'handleWebhook');

(verifySignature as jest.Mock).mockReturnValue(true);

await expect(
webhookController.processWebhook(MOCK_SIGNATURE, webhook),
).rejects.toThrow('Invalid webhook event type: task_completed');
).rejects.toThrow('Invalid webhook event type: job_completed');

expect(webhookService.handleWebhook).toHaveBeenCalledWith(webhook);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ describe('WebhookService', () => {
const webhook: WebhookDto = {
chainId,
escrowAddress,
eventType: EventType.TASK_COMPLETED,
eventType: EventType.JOB_COMPLETED,
};

await expect(webhookService.handleWebhook(webhook)).rejects.toThrow(
'Invalid webhook event type: task_completed',
'Invalid webhook event type: job_completed',
);
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export enum EventType {
TASK_COMPLETED = 'task_completed',
JOB_COMPLETED = 'job_completed',
ESCROW_COMPLETED = 'escrow_completed',
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('WebhookService', () => {
const validDto: WebhookDto = {
chainId: ChainId.LOCALHOST,
escrowAddress: MOCK_ADDRESS,
eventType: EventType.TASK_COMPLETED,
eventType: EventType.JOB_COMPLETED,
};

jest
Expand Down Expand Up @@ -141,7 +141,7 @@ describe('WebhookService', () => {
const validDto: WebhookDto = {
chainId: ChainId.LOCALHOST,
escrowAddress: MOCK_ADDRESS,
eventType: EventType.TASK_COMPLETED,
eventType: EventType.JOB_COMPLETED,
};

jest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class WebhookService {
* @throws {Error} - An error object if an error occurred.
*/
public async createIncomingWebhook(dto: WebhookDto): Promise<void> {
if (dto.eventType !== EventType.TASK_COMPLETED) {
if (dto.eventType !== EventType.JOB_COMPLETED) {
throw new ControlledError(
ErrorWebhook.InvalidEventType,
HttpStatus.BAD_REQUEST,
Expand Down