social-links
Version:
Validate & sanitize social links
30 lines • 1.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var main_1 = require("../main");
describe('PROFILE: lemmy_world', function () {
var sl;
var profile = 'lemmy_world';
var profileId = 'gkucmierz';
var desktop = "https://lemmy.world/u/".concat(profileId);
beforeEach(function () {
sl = new main_1.SocialLinks();
});
it('should lemmy_world basics', function () {
expect(sl.hasProfile(profile)).toBeTruthy();
expect(sl.isValid(profile, desktop)).toBeTruthy();
expect(sl.getProfileId(profile, desktop)).toBe(profileId);
expect(sl.getLink(profile, profileId)).toBe(desktop);
expect(sl.getLink(profile, profileId, main_1.TYPE_DESKTOP)).toBe(desktop);
});
it('should lemmy_world valid wariations', function () {
expect(sl.isValid(profile, "https://lemmy.world/u/".concat(profileId))).toBeTruthy();
expect(sl.isValid(profile, "http://lemmy.world/u/".concat(profileId))).toBeTruthy();
expect(sl.isValid(profile, "lemmy.world/u/".concat(profileId, "/"))).toBeTruthy();
expect(sl.isValid(profile, "http://lemmy.world/u/".concat(profileId, "/"))).toBeTruthy();
});
it('should not lemmy_world invalid wariations', function () {
expect(sl.isValid(profile, "www.lemmy.world/u/".concat(profileId))).toBeFalsy();
expect(sl.isValid(profile, "http://www.lemmy.world/u/".concat(profileId))).toBeFalsy();
});
});
//# sourceMappingURL=lemmy_world.spec.js.map