@aller/blink
Version:
A library for tracking user behaviour.
24 lines • 1.38 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var get_id_from_url_1 = __importDefault(require("../get-id-from-url"));
describe('getIdFromUrl', function () {
it('should get id from normal db url', function () {
expect(get_id_from_url_1.default('https://www.dagbladet.no/a/89324982')).toBe('dagbladet.no/89324982');
});
it('should get id from dagbladet video url', function () {
expect(get_id_from_url_1.default('https://www.dagbladet.no/video/r6V6X_1TPw4', 'www.dagbladet.no')).toBe('dagbladet.no/b6ad2c67eaf3f6b760eea09f0de0ae2e');
});
it('should get fallback id for a front', function () {
expect(get_id_from_url_1.default('https://www.dagbladet.no/', 'www.fallback.no')).toBe('www.fallback.no');
});
it('should get fallback id for a front with query params', function () {
expect(get_id_from_url_1.default('https://www.dagbladet.no/?meta=1', 'www.fallback.no')).toBe('www.fallback.no');
});
it('should get fallback id for a front with hash', function () {
expect(get_id_from_url_1.default('https://www.dagbladet.no/#tag', 'www.fallback.no')).toBe('www.fallback.no');
});
});
//# sourceMappingURL=get-id-from-url.test.js.map