social-links
Version:
Validate & sanitize social links
34 lines • 1.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var main_1 = require("../main");
describe('PROFILE: stackoverflow', function () {
var sl;
beforeEach(function () {
sl = new main_1.SocialLinks();
});
var testProfileDesktop = function (profile, profileId, desktop) {
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);
expect(sl.sanitize(profile, desktop)).toBe(desktop);
expect(sl.sanitize(profile, desktop, main_1.TYPE_DESKTOP)).toBe(desktop);
};
it('should stackoverflow', function () {
var profile = 'stackoverflow';
var profileId = '3573210';
var desktop = "https://stackoverflow.com/users/".concat(profileId);
testProfileDesktop(profile, profileId, desktop);
});
it('should recognize full link', function () {
var profile = 'stackoverflow';
var profileId = '3573210';
var desktop = "https://stackoverflow.com/users/".concat(profileId);
var fullLink = "https://stackoverflow.com/users/".concat(profileId, "/gkucmierz");
expect(sl.isValid(profile, fullLink)).toBeTruthy();
expect(sl.getProfileId(profile, fullLink)).toBe(profileId);
expect(sl.sanitize(profile, fullLink)).toBe(desktop);
});
});
//# sourceMappingURL=stackoverflow.spec.js.map