smc-hub
Version:
CoCalc: Backend webserver component
53 lines (44 loc) • 1.8 kB
JavaScript
// Generated by CoffeeScript 2.5.1
(function() {
//########################################################################
// This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
// License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
//########################################################################
var DNS, body1, body1_exp, expect, support;
expect = require('expect');
support = require('../../support');
({DNS} = require('smc-util/theme'));
body1 = `foo foo foo
aasdf ölkj ölkj ölkj
bar https://cocalc.com/projects/14eed217-2d3c-4975-a381-b69edcb40e0e/files/scratch/coffee.sagews?session=default baz
https://this.not.com/asdf not
or http://www.cocalc.com/asdf?something=123
and this: https://cocalc.com/asdfasdfsafd/asdf.xx
baz`;
body1_exp = `foo foo foo
aasdf ölkj ölkj ölkj
bar https://cocalc.com/projects/14eed217-2d3c-4975-a381-b69edcb40e0e/files/scratch/coffee.sagews?session= baz
https://this.not.com/asdf not
or http://www.cocalc.com/asdf?something=123&session=
and this: https://cocalc.com/asdfasdfsafd/asdf.xx?session=
baz`;
describe('support fixSessions -- ', function() {
var fs;
fs = support.fixSessions;
it(`detects http ${DNS}`, function() {
return expect(fs(`foo http://${DNS}/foo bar`)).toBe(`foo http://${DNS}/foo?session= bar`);
});
it(`detects https ${DNS}`, function() {
return expect(fs(`foo https://${DNS}/foo bar`)).toBe(`foo https://${DNS}/foo?session= bar`);
});
it("ignores other domains", function() {
var x;
x = "test https://bazbar.info/ next";
return expect(fs(x)).toBe(x);
});
return it('body1', function() {
return expect(fs(body1)).toBe(body1_exp);
});
});
}).call(this);
//# sourceMappingURL=support.js.map