aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/logger/err-serializer.spec.js
blob: 03d9762e1b8f8eb4cb6e84fc1cf443c4417826f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const configSerializer = require('../../lib/logger/err-serializer');

describe('logger/err-serializer', () => {
  it('expands errors', () => {
    const err = {
      a: 1,
      b: 2,
      message: 'some message',
      response: {
        body: 'some response body',
      },
      gotOptions: {
        headers: {
          authorization: 'Bearer abc',
        },
      },
    };
    expect(configSerializer(err)).toMatchSnapshot();
  });
  it('handles missing fields', () => {
    const err = { a: 1, stack: 'foo', body: 'some body' };
    expect(configSerializer(err)).toMatchSnapshot();
  });
});