|
@@ -5,7 +5,6 @@ import { expect } from 'chai';
|
|
|
import * as send from 'send';
|
|
|
|
|
|
import * as ChildProcess from 'node:child_process';
|
|
|
-import * as crypto from 'node:crypto';
|
|
|
import { once } from 'node:events';
|
|
|
import * as fs from 'node:fs';
|
|
|
import * as http from 'node:http';
|
|
@@ -130,54 +129,6 @@ describe('session module', () => {
|
|
|
expect(cs.some(c => c.name === name && c.value === value)).to.equal(true);
|
|
|
});
|
|
|
|
|
|
- it('does not match on empty domain filter strings', async () => {
|
|
|
- const { cookies } = session.defaultSession;
|
|
|
- const name = crypto.randomBytes(20).toString('hex');
|
|
|
- const value = '1';
|
|
|
- const url = 'https://microsoft.com/';
|
|
|
-
|
|
|
- await cookies.set({ url, name, value });
|
|
|
- const cs = await cookies.get({ domain: '' });
|
|
|
- expect(cs.some(c => c.name === name && c.value === value)).to.equal(false);
|
|
|
- cookies.remove(url, name);
|
|
|
- });
|
|
|
-
|
|
|
- it('gets domain-equal cookies', async () => {
|
|
|
- const { cookies } = session.defaultSession;
|
|
|
- const name = crypto.randomBytes(20).toString('hex');
|
|
|
- const value = '1';
|
|
|
- const url = 'https://microsoft.com/';
|
|
|
-
|
|
|
- await cookies.set({ url, name, value });
|
|
|
- const cs = await cookies.get({ domain: 'microsoft.com' });
|
|
|
- expect(cs.some(c => c.name === name && c.value === value)).to.equal(true);
|
|
|
- cookies.remove(url, name);
|
|
|
- });
|
|
|
-
|
|
|
- it('gets domain-inclusive cookies', async () => {
|
|
|
- const { cookies } = session.defaultSession;
|
|
|
- const name = crypto.randomBytes(20).toString('hex');
|
|
|
- const value = '1';
|
|
|
- const url = 'https://subdomain.microsoft.com/';
|
|
|
-
|
|
|
- await cookies.set({ url, name, value });
|
|
|
- const cs = await cookies.get({ domain: 'microsoft.com' });
|
|
|
- expect(cs.some(c => c.name === name && c.value === value)).to.equal(true);
|
|
|
- cookies.remove(url, name);
|
|
|
- });
|
|
|
-
|
|
|
- it('omits domain-exclusive cookies', async () => {
|
|
|
- const { cookies } = session.defaultSession;
|
|
|
- const name = crypto.randomBytes(20).toString('hex');
|
|
|
- const value = '1';
|
|
|
- const url = 'https://microsoft.com';
|
|
|
-
|
|
|
- await cookies.set({ url, name, value });
|
|
|
- const cs = await cookies.get({ domain: 'subdomain.microsoft.com' });
|
|
|
- expect(cs.some(c => c.name === name && c.value === value)).to.equal(false);
|
|
|
- cookies.remove(url, name);
|
|
|
- });
|
|
|
-
|
|
|
it('rejects when setting a cookie with missing required fields', async () => {
|
|
|
const { cookies } = session.defaultSession;
|
|
|
const name = '1';
|