UNPKG

@guardian/pan-domain-node

Version:

NodeJs implementation of Guardian pan-domain auth verification

18 lines (17 loc) 693 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("../src/utils"); const fixtures_1 = require("./fixtures"); const url_1 = require("url"); test("decode a cookie", () => { const parsedCookie = (0, utils_1.parseCookie)(fixtures_1.sampleCookie); expect(parsedCookie).toBeDefined(); // Unfortunately the above expect() doesn't narrow the type if (parsedCookie) { const { data, signature } = parsedCookie; expect(signature.length).toBe(684); const params = new url_1.URLSearchParams(data); expect(params.get("firstName")).toBe("Test"); expect(params.get("lastName")).toBe("User"); } });