social-links
Version:
Validate & sanitize social links
43 lines • 1.89 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var main_1 = require("../main");
describe('PROFILE: pinterest', 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 pinterest', function () {
var profile = 'pinterest';
var profileId = 'gkucmierz';
var desktop = "https://pinterest.com/".concat(profileId);
testProfileDesktop(profile, profileId, desktop);
});
it('should work with cc subdomain', function () {
var profile = 'pinterest';
var profileId = 'gkucmierz';
var desktop = "https://pl.pinterest.com/".concat(profileId);
expect(sl.isValid(profile, desktop)).toBeTruthy();
});
it("should work with 'www' subdomain", function () {
var profile = 'pinterest';
var profileId = 'gkucmierz';
var desktop = "https://www.pinterest.com/".concat(profileId);
expect(sl.isValid(profile, desktop)).toBeTruthy();
});
it("should not work with more than 3 characters subdomain", function () {
var profile = 'pinterest';
var profileId = 'gkucmierz';
var desktop = "https://abcd.pinterest.com/".concat(profileId);
expect(sl.isValid(profile, desktop)).toBeFalsy();
});
});
//# sourceMappingURL=pinterest.spec.js.map