Skip to content

Commit

Permalink
test: fix @types/superagent type regression
Browse files Browse the repository at this point in the history
Regression caused by DefinitelyTyped/DefinitelyTyped#67347 and its interaction with express-session I believe.

The value is a string[], not a string
  • Loading branch information
voxpelli committed Nov 21, 2023
1 parent 84f525a commit 649888c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/integration/express.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ describe('Express', () => {
return request(app)
.get('/')
.then(res => {
const sessionCookie = new Cookie(res.header['set-cookie'][0]);
const cookieHeader = /** @type {string[]|undefined} */ (res.header['set-cookie']);

if (!cookieHeader || !cookieHeader[0]) {
throw new TypeError('Unexpected cookie header');
}

const sessionCookie = new Cookie(cookieHeader[0]);
const cookieValue = decodeURIComponent(sessionCookie.value);

cookieValue.slice(0, 2).should.equal('s:');
Expand Down

0 comments on commit 649888c

Please sign in to comment.