@copperjs/copper
Version:
A lightweight chromium grid
32 lines • 1.28 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const utils_1 = require("./utils");
describe('utils', () => {
it('adds websocket url to a session returned to client', () => {
const session = { id: 'id' };
const req = { headers: { host: 'localhost' } };
const result = utils_1.addWsUrl(req, session);
chai_1.expect(result).to.eql(Object.assign(Object.assign({}, session), { webSocketDebuggerUrl: 'ws://localhost/ws/id', 'goog:chromeOptions': {
debuggerAddress: 'localhost/ws/id',
} }));
chai_1.expect(result).to.not.equal(session);
});
it('removes websocket url from a session returned to client', () => {
const session = {
id: 'id',
webSocketDebuggerUrl: 'ws://localhost/ws/id',
'goog:chromeOptions': {
debuggerAddress: 'localhost/ws/id',
},
};
const result = utils_1.removeWsUrl(session);
chai_1.expect(result).to.eql({
id: 'id',
webSocketDebuggerUrl: undefined,
'goog:chromeOptions': undefined,
});
chai_1.expect(result).to.not.equal(session);
});
});
//# sourceMappingURL=utils.test.js.map