From ad9c88710e7842028d81c7635d78f15b1691c5ca Mon Sep 17 00:00:00 2001 From: Will Harney Date: Fri, 2 Feb 2024 13:05:35 -0500 Subject: [PATCH] Add test for cookie custom inspect --- lib/__tests__/cookieUtils.spec.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lib/__tests__/cookieUtils.spec.ts diff --git a/lib/__tests__/cookieUtils.spec.ts b/lib/__tests__/cookieUtils.spec.ts new file mode 100644 index 00000000..e1458d26 --- /dev/null +++ b/lib/__tests__/cookieUtils.spec.ts @@ -0,0 +1,17 @@ +import { inspect } from 'node:util' +import { Cookie } from '../cookie/cookie' + +describe('Cookie utils', () => { + describe('custom inspect', () => { + it('should be a readable string', () => { + const cookie = new Cookie({ + key: 'test', + value: 'b', + maxAge: 60, + }) + expect(inspect(cookie)).toBe( + 'Cookie="test=b; Max-Age=60; hostOnly=?; aAge=?; cAge=0ms"', + ) + }) + }) +})