breaking: remove socket.io/flags.js

refactor: helpers.loginUser returns a single object {jar, csrf_token}
This commit is contained in:
Barış Soner Uşaklı
2021-11-22 19:23:51 -05:00
parent f0d192fbfd
commit c5f08fdc81
16 changed files with 175 additions and 300 deletions

View File

@@ -187,14 +187,12 @@ describe('authentication', () => {
});
it('should regenerate the session identifier on successful login', async () => {
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[hostname][path]['express.sid']).match(matchRegexp)[1];
await logout(jar);
const newJar = await login('regular', 'regularpwd');
await helpers.logoutUser(jar);
const newJar = (await helpers.loginUser('regular', 'regularpwd')).jar;
const newSid = String(newJar._jar.store.idx[hostname][path]['express.sid']).match(matchRegexp)[1];
assert.notStrictEqual(newSid, sid);