forked from Airtable/airtable.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathairtable_error.test.js
32 lines (26 loc) · 1.23 KB
/
airtable_error.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
var AirtableError = require('../lib/airtable_error');
describe('AirtableError', function() {
describe('#toString', function() {
it('includes the provided `error` value', function() {
var error = new AirtableError('value of error parameter');
expect(error.toString()).toEqual(expect.stringContaining('value of error parameter'));
});
it('includes the provided `message` value', function() {
var error = new AirtableError(null, 'value of message parameter');
expect(error.toString()).toEqual(expect.stringContaining('value of message parameter'));
});
it('includes the provided `statusCode` value', function() {
var error = new AirtableError(null, null, 404);
expect(error.toString()).toEqual(expect.stringContaining('404'));
});
});
it('has a stacktrace', function() {
var error = new AirtableError('TEST_ERROR', 'A test error', 400);
expect(error.stack).toEqual(expect.stringContaining('airtable_error.test.js'));
});
it('has a name', function() {
var error = new AirtableError('TEST_ERROR', 'A test error', 400);
expect(error.name).toEqual('AirtableError');
});
});