npm package diff
Package: @forge/events
Versions: 0.8.38-experimental-10722bc - 0.9.2-next.1
File: package/src/__test__/jobProgress.test.ts
Index: package/src/__test__/jobProgress.test.ts
===================================================================
--- package/src/__test__/jobProgress.test.ts
+++ package/src/__test__/jobProgress.test.ts
@@ -22,12 +22,16 @@
);
const jobProgress = getJobProgress('test-queue-name#test-job-id', apiClientMock);
const response = await jobProgress.getStats();
const { success, inProgress, failed } = await response.json();
- verifyApiClientCalledWith(apiClientMock, '/webhook/queue/stats/{cloudId}/{environmentId}/{appId}/{appVersion}', {
- queueName: 'test-queue-name',
- jobId: 'test-job-id'
- });
+ verifyApiClientCalledWith(
+ apiClientMock,
+ '/webhook/queue/stats/{contextAri}/{environmentId}/{appId}/{appVersion}',
+ {
+ queueName: 'test-queue-name',
+ jobId: 'test-job-id'
+ }
+ );
expect(success).toEqual(100);
expect(inProgress).toEqual(50);
expect(failed).toEqual(1);
});
@@ -43,22 +47,30 @@
const jobProgress = getJobProgress('test-queue-name#test-job-id', apiClientMock);
await expect(jobProgress.getStats()).rejects.toThrow(
new JobDoesNotExistError(`The job test-job-id was not found for the queue test-queue-name.`)
);
- verifyApiClientCalledWith(apiClientMock, '/webhook/queue/stats/{cloudId}/{environmentId}/{appId}/{appVersion}', {
- queueName: 'test-queue-name',
- jobId: 'test-job-id'
- });
+ verifyApiClientCalledWith(
+ apiClientMock,
+ '/webhook/queue/stats/{contextAri}/{environmentId}/{appId}/{appVersion}',
+ {
+ queueName: 'test-queue-name',
+ jobId: 'test-job-id'
+ }
+ );
});
it('should throw RateLimitError', async () => {
const apiClientMock = getMockFetchMethod({}, 429);
const jobProgress = getJobProgress('test-queue-name#test-job-id', apiClientMock);
await expect(jobProgress.getStats()).rejects.toThrow(new RateLimitError(`Too many requests.`));
- verifyApiClientCalledWith(apiClientMock, '/webhook/queue/stats/{cloudId}/{environmentId}/{appId}/{appVersion}', {
- queueName: 'test-queue-name',
- jobId: 'test-job-id'
- });
+ verifyApiClientCalledWith(
+ apiClientMock,
+ '/webhook/queue/stats/{contextAri}/{environmentId}/{appId}/{appVersion}',
+ {
+ queueName: 'test-queue-name',
+ jobId: 'test-job-id'
+ }
+ );
});
it('should throw InternalServerError', async () => {
const apiClientMock = getMockFetchMethod(
@@ -72,24 +84,32 @@
const jobProgress = getJobProgress('test-queue-name#test-job-id', apiClientMock);
await expect(jobProgress.getStats()).rejects.toThrow(
new InternalServerError(`513 Status Text: Service is not available`, 513)
);
- verifyApiClientCalledWith(apiClientMock, '/webhook/queue/stats/{cloudId}/{environmentId}/{appId}/{appVersion}', {
- queueName: 'test-queue-name',
- jobId: 'test-job-id'
- });
+ verifyApiClientCalledWith(
+ apiClientMock,
+ '/webhook/queue/stats/{contextAri}/{environmentId}/{appId}/{appVersion}',
+ {
+ queueName: 'test-queue-name',
+ jobId: 'test-job-id'
+ }
+ );
});
});
describe('cancel', () => {
it('should call the queue/cancel endpoint', async () => {
const apiClientMock = getMockFetchMethod({}, 204);
const jobProgress = getJobProgress('test-queue-name#test-job-id', apiClientMock);
const response = await jobProgress.cancel();
- verifyApiClientCalledWith(apiClientMock, '/webhook/queue/cancel/{cloudId}/{environmentId}/{appId}/{appVersion}', {
- queueName: 'test-queue-name',
- jobId: 'test-job-id'
- });
+ verifyApiClientCalledWith(
+ apiClientMock,
+ '/webhook/queue/cancel/{contextAri}/{environmentId}/{appId}/{appVersion}',
+ {
+ queueName: 'test-queue-name',
+ jobId: 'test-job-id'
+ }
+ );
expect(response.status).toEqual(204);
});
it('should throw JobDoesNotExistError', async () => {
@@ -103,12 +123,16 @@
const jobProgress = getJobProgress('test-queue-name#test-job-id', apiClientMock);
await expect(jobProgress.cancel()).rejects.toThrow(
new JobDoesNotExistError(`The job test-job-id was not found for the queue test-queue-name.`)
);
- verifyApiClientCalledWith(apiClientMock, '/webhook/queue/cancel/{cloudId}/{environmentId}/{appId}/{appVersion}', {
- queueName: 'test-queue-name',
- jobId: 'test-job-id'
- });
+ verifyApiClientCalledWith(
+ apiClientMock,
+ '/webhook/queue/cancel/{contextAri}/{environmentId}/{appId}/{appVersion}',
+ {
+ queueName: 'test-queue-name',
+ jobId: 'test-job-id'
+ }
+ );
});
});
it('should throw InternalServerError when WHP returns 422 response', async () => {
@@ -122,9 +146,9 @@
await expect(jobProgress.getStats()).rejects.toThrow(
new InternalServerError(`422 Status Text: jobId must not be null, queueName must not be null`)
);
- verifyApiClientCalledWith(apiClientMock, '/webhook/queue/stats/{cloudId}/{environmentId}/{appId}/{appVersion}', {
+ verifyApiClientCalledWith(apiClientMock, '/webhook/queue/stats/{contextAri}/{environmentId}/{appId}/{appVersion}', {
queueName: 'test-queue-name',
jobId: 'test-job-id'
});
});