Repository URL to install this package:
|
Version:
5.0.0-rc.5 ▾
|
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _getCookieDomain = _interopRequireDefault(require("./getCookieDomain"));
describe('getCookieDomain', () => {
beforeAll(() => {
delete window.location;
Object.defineProperty(window, 'location', {
value: {}
});
});
test('only top-level domains', async () => {
Object.defineProperty(window.location, 'hostname', {
value: 'subdomain.topleveldomain.com',
configurable: true
});
expect((0, _getCookieDomain.default)()).toEqual('.topleveldomain.com');
Object.defineProperty(window.location, 'hostname', {
value: 'more.subdomain.topleveldomain.com',
configurable: true
});
expect((0, _getCookieDomain.default)()).toEqual('.topleveldomain.com');
});
test('does not add dot in front of localhost', async () => {
Object.defineProperty(window.location, 'hostname', {
value: 'localhost',
configurable: true
});
expect((0, _getCookieDomain.default)()).toEqual('localhost');
});
});
//# sourceMappingURL=getCookieDomain.spec.js.map