Initial support for job queue
This commit is contained in:
parent
1238cca538
commit
bbd7fd3854
22 changed files with 1708 additions and 28 deletions
33
ts/test-node/jobs/JobError_test.ts
Normal file
33
ts/test-node/jobs/JobError_test.ts
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
|
||||
import { JobError } from '../../jobs/JobError';
|
||||
|
||||
describe('JobError', () => {
|
||||
it('stores the provided argument as a property', () => {
|
||||
const fakeError = new Error('uh oh');
|
||||
const jobError1 = new JobError(fakeError);
|
||||
assert.strictEqual(jobError1.lastErrorThrownByJob, fakeError);
|
||||
|
||||
const jobError2 = new JobError(123);
|
||||
assert.strictEqual(jobError2.lastErrorThrownByJob, 123);
|
||||
});
|
||||
|
||||
it('if passed an Error, augments its `message`', () => {
|
||||
const fakeError = new Error('uh oh');
|
||||
const jobError = new JobError(fakeError);
|
||||
|
||||
assert.strictEqual(jobError.message, 'Job failed. Last error: uh oh');
|
||||
});
|
||||
|
||||
it('if passed a non-Error, stringifies it', () => {
|
||||
const jobError = new JobError({ foo: 'bar' });
|
||||
|
||||
assert.strictEqual(
|
||||
jobError.message,
|
||||
'Job failed. Last error: {"foo":"bar"}'
|
||||
);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue