social-links
Version:
Validate & sanitize social links
37 lines • 1.86 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var main_1 = require("../main");
describe('PROFILE: mastodon', function () {
var sl;
var profile = 'mastodon';
var profileId = 'gkucmierz';
var desktop = "https://mastodon.social/@".concat(profileId);
beforeEach(function () {
sl = new main_1.SocialLinks();
});
it('should mastodon 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);
});
var checkMastodonMatches = function (domain, profileId) {
expect(sl.isValid(profile, "https://".concat(domain, "/@").concat(profileId))).toBeTruthy();
expect(sl.isValid(profile, "http://".concat(domain, "/@").concat(profileId))).toBeTruthy();
expect(sl.isValid(profile, "".concat(domain, "/@").concat(profileId, "/"))).toBeTruthy();
expect(sl.isValid(profile, "http://".concat(domain, "/@").concat(profileId, "/"))).toBeTruthy();
expect(sl.isValid(profile, "www.".concat(domain, "/@").concat(profileId))).toBeTruthy();
expect(sl.isValid(profile, "http://www.".concat(domain, "/@").concat(profileId))).toBeTruthy();
};
it('should mastodon.social valid wariations', function () {
checkMastodonMatches('mastodon.social', profileId);
});
it('should mstdn.social valid wariations', function () {
checkMastodonMatches('mstdn.social', profileId);
});
it('should mastodon.world valid wariations', function () {
checkMastodonMatches('mastodon.world', profileId);
});
});
//# sourceMappingURL=mastodon.spec.js.map