From f4c5050a16256ec4f1a7976d2013c8413e0f2d58 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 14 Apr 2021 16:20:09 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20failure=20on=20session=20reroll=20?= =?UTF-8?q?=F0=9F=8D=A3=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/authentication.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/authentication.js b/test/authentication.js index 627cc7462e..1769fd5712 100644 --- a/test/authentication.js +++ b/test/authentication.js @@ -2,6 +2,7 @@ const assert = require('assert'); +const url = require('url'); const async = require('async'); const nconf = require('nconf'); const request = require('request'); @@ -228,11 +229,12 @@ describe('authentication', () => { const login = util.promisify(helpers.loginUser); const logout = util.promisify(helpers.logoutUser); const matchRegexp = /express\.sid=s%3A(.+?);/; + const { hostname, path } = url.parse(nconf.get('url')); - const sid = String(jar._jar.store.idx.localhost['/']['express.sid']).match(matchRegexp)[1]; + const sid = String(jar._jar.store.idx[hostname][path]['express.sid']).match(matchRegexp)[1]; await logout(jar); const newJar = await login('regular', 'regularpwd'); - const newSid = String(newJar._jar.store.idx.localhost['/']['express.sid']).match(matchRegexp)[1]; + const newSid = String(newJar._jar.store.idx[hostname][path]['express.sid']).match(matchRegexp)[1]; assert.notStrictEqual(newSid, sid); });