diff --git a/test/headers.js b/test/headers.js index 48a731e..4690438 100644 --- a/test/headers.js +++ b/test/headers.js @@ -1,3 +1,4 @@ +import util from 'util'; import {Headers} from '../src/index.js'; import chai from 'chai'; import chaiIterator from 'chai-iterator'; @@ -232,4 +233,17 @@ describe('Headers', () => { expect(() => new Headers('b2')).to.throw(TypeError); expect(() => new Headers({[Symbol.iterator]: 42})).to.throw(TypeError); }); + + it('should use a custom inspect function', () => { + const headers = new Headers([ + ['Host', 'thehost'], + ['Host', 'notthehost'], + ['a', '1'], + ['b', '2'], + ['a', '3'] + ]); + + // eslint-disable-next-line quotes + expect(util.format(headers)).to.equal("{ a: [ '1', '3' ], b: '2', host: 'thehost' }"); + }); });