mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-09-14 00:40:08 +00:00
Test denied continuation scope mismatches
This commit is contained in:
@@ -52,8 +52,11 @@ test('approved continuation enqueue matches the stored approval scope key', asyn
|
|||||||
const first = await dispatch(window, 'enqueue', request);
|
const first = await dispatch(window, 'enqueue', request);
|
||||||
const approvalScopeKey = window.slopsmith.jobs._test.jobs.get(first.payload.job.jobId).approvalScopeKey;
|
const approvalScopeKey = window.slopsmith.jobs._test.jobs.get(first.payload.job.jobId).approvalScopeKey;
|
||||||
|
|
||||||
|
const rejected = await dispatch(window, 'enqueue', { ...request, authorization: 'approved-continuation', approvalScopeKey: `${approvalScopeKey}-mismatch` });
|
||||||
const continued = await dispatch(window, 'enqueue', { ...request, authorization: 'approved-continuation', approvalScopeKey });
|
const continued = await dispatch(window, 'enqueue', { ...request, authorization: 'approved-continuation', approvalScopeKey });
|
||||||
|
|
||||||
|
assert.equal(rejected.status, 'blocked');
|
||||||
|
assert.equal(rejected.outcome, 'denied');
|
||||||
assert.equal(continued.status, 'applied');
|
assert.equal(continued.status, 'applied');
|
||||||
assert.equal(calls.length, 2);
|
assert.equal(calls.length, 2);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -137,8 +137,11 @@ test('retry accepts approved continuation using the stored scope key', async ()
|
|||||||
const approvalScopeKey = window.slopsmith.jobs._test.jobs.get(jobId).approvalScopeKey;
|
const approvalScopeKey = window.slopsmith.jobs._test.jobs.get(jobId).approvalScopeKey;
|
||||||
|
|
||||||
window.slopsmith.jobs.fail(provider.providerId, jobId, { category: 'provider-failure', safeReason: 'retryable failure', retryable: true });
|
window.slopsmith.jobs.fail(provider.providerId, jobId, { category: 'provider-failure', safeReason: 'retryable failure', retryable: true });
|
||||||
|
const rejected = await dispatch(window, 'retry', { jobId, authorization: 'approved-continuation', approvalScopeKey: `${approvalScopeKey}-mismatch` });
|
||||||
const retried = await dispatch(window, 'retry', { jobId, authorization: 'approved-continuation', approvalScopeKey });
|
const retried = await dispatch(window, 'retry', { jobId, authorization: 'approved-continuation', approvalScopeKey });
|
||||||
|
|
||||||
|
assert.equal(rejected.status, 'blocked');
|
||||||
|
assert.equal(rejected.outcome, 'denied');
|
||||||
assert.equal(retried.status, 'retry-started');
|
assert.equal(retried.status, 'retry-started');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user