social-links
Version:
Validate & sanitize social links
30 lines • 1.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var main_1 = require("../main");
describe('PROFILE: youtube', function () {
var sl;
beforeEach(function () {
sl = new main_1.SocialLinks();
});
var testProfile = function (profile, profileId, given, expected) {
expect(sl.hasProfile(profile)).toBeTruthy();
expect(sl.isValid(profile, given)).toBeTruthy();
expect(sl.getProfileId(profile, given)).toBe(profileId);
expect(sl.getLink(profile, profileId)).toBe(expected);
expect(sl.getLink(profile, profileId, main_1.TYPE_DESKTOP)).toBe(expected);
expect(sl.sanitize(profile, given)).toBe(expected);
expect(sl.sanitize(profile, given, main_1.TYPE_DESKTOP)).toBe(expected);
};
it('should work with /@user', function () {
var profile = 'youtube';
var profileId = 'gkucmierz';
var curr = "https://youtube.com/@".concat(profileId);
var old = [
"https://youtube.com/channel/".concat(profileId),
"https://youtube.com/user/".concat(profileId),
curr,
];
old.map(function (url) { return testProfile(profile, profileId, url, curr); });
});
});
//# sourceMappingURL=youtube.spec.js.map