|
4 | 4 | * you may not use this file except in compliance with the Elastic License. |
5 | 5 | */ |
6 | 6 |
|
7 | | -import expect from '@kbn/expect'; |
8 | | -import { WorkerTimeoutError, UnspecifiedWorkerError } from '../../helpers/errors'; |
| 7 | +import { WorkerTimeoutError, UnspecifiedWorkerError } from './errors'; |
9 | 8 |
|
10 | 9 | describe('custom errors', function () { |
11 | 10 | describe('WorkerTimeoutError', function () { |
12 | 11 | it('should be function', () => { |
13 | | - expect(WorkerTimeoutError).to.be.a('function'); |
| 12 | + expect(typeof WorkerTimeoutError).toBe('function'); |
14 | 13 | }); |
15 | 14 |
|
16 | 15 | it('should have a name', function () { |
17 | 16 | const err = new WorkerTimeoutError('timeout error'); |
18 | | - expect(err).to.have.property('name', 'WorkerTimeoutError'); |
| 17 | + expect(err).toHaveProperty('name', 'WorkerTimeoutError'); |
19 | 18 | }); |
20 | 19 |
|
21 | 20 | it('should take a jobId property', function () { |
22 | 21 | const err = new WorkerTimeoutError('timeout error', { jobId: 'il7hl34rqlo8ro' }); |
23 | | - expect(err).to.have.property('jobId', 'il7hl34rqlo8ro'); |
| 22 | + expect(err).toHaveProperty('jobId', 'il7hl34rqlo8ro'); |
24 | 23 | }); |
25 | 24 |
|
26 | 25 | it('should take a timeout property', function () { |
27 | 26 | const err = new WorkerTimeoutError('timeout error', { timeout: 15000 }); |
28 | | - expect(err).to.have.property('timeout', 15000); |
| 27 | + expect(err).toHaveProperty('timeout', 15000); |
29 | 28 | }); |
30 | 29 |
|
31 | 30 | it('should be stringifyable', function () { |
32 | 31 | const err = new WorkerTimeoutError('timeout error'); |
33 | | - expect(`${err}`).to.equal('WorkerTimeoutError: timeout error'); |
| 32 | + expect(`${err}`).toEqual('WorkerTimeoutError: timeout error'); |
34 | 33 | }); |
35 | 34 | }); |
36 | 35 |
|
37 | 36 | describe('UnspecifiedWorkerError', function () { |
38 | 37 | it('should be function', () => { |
39 | | - expect(UnspecifiedWorkerError).to.be.a('function'); |
| 38 | + expect(typeof UnspecifiedWorkerError).toBe('function'); |
40 | 39 | }); |
41 | 40 |
|
42 | 41 | it('should have a name', function () { |
43 | 42 | const err = new UnspecifiedWorkerError('unspecified error'); |
44 | | - expect(err).to.have.property('name', 'UnspecifiedWorkerError'); |
| 43 | + expect(err).toHaveProperty('name', 'UnspecifiedWorkerError'); |
45 | 44 | }); |
46 | 45 |
|
47 | 46 | it('should take a jobId property', function () { |
48 | 47 | const err = new UnspecifiedWorkerError('unspecified error', { jobId: 'il7hl34rqlo8ro' }); |
49 | | - expect(err).to.have.property('jobId', 'il7hl34rqlo8ro'); |
| 48 | + expect(err).toHaveProperty('jobId', 'il7hl34rqlo8ro'); |
50 | 49 | }); |
51 | 50 |
|
52 | 51 | it('should be stringifyable', function () { |
53 | 52 | const err = new UnspecifiedWorkerError('unspecified error'); |
54 | | - expect(`${err}`).to.equal('UnspecifiedWorkerError: unspecified error'); |
| 53 | + expect(`${err}`).toEqual('UnspecifiedWorkerError: unspecified error'); |
55 | 54 | }); |
56 | 55 | }); |
57 | 56 | }); |
0 commit comments