social-links
Advanced tools
Comparing version 1.8.1 to 1.9.0
@@ -11,3 +11,8 @@ export declare const youtube: { | ||
group: number; | ||
pattern: string; | ||
type?: undefined; | ||
} | { | ||
match: string; | ||
group: number; | ||
type?: undefined; | ||
pattern?: undefined; | ||
@@ -14,0 +19,0 @@ })[]; |
@@ -10,6 +10,10 @@ "use strict"; | ||
match: '(https?://)?(www.)?youtube.com/channel/({PROFILE_ID})/?', group: 3, type: types_1.TYPE_DESKTOP, | ||
pattern: 'https://youtube.com/user/{PROFILE_ID}' | ||
}, | ||
{ | ||
match: '(https?://)?(www.)?youtube.com/user/({PROFILE_ID})/?', group: 3, | ||
pattern: 'https://youtube.com/channel/{PROFILE_ID}' | ||
}, | ||
{ | ||
match: '(https?://)?m.youtube.com/c/({PROFILE_ID})/?', group: 2, type: types_1.TYPE_MOBILE, | ||
match: '(https?://)?m.youtube.com/c/({PROFILE_ID})/?', group: 2, | ||
pattern: 'https://m.youtube.com/c/{PROFILE_ID}' | ||
@@ -16,0 +20,0 @@ }, |
@@ -9,32 +9,20 @@ "use strict"; | ||
}); | ||
var testProfile = function (profile, profileId, desktop, mobile) { | ||
var testProfile = function (profile, profileId, given, expected) { | ||
expect(sl.hasProfile(profile)).toBeTruthy(); | ||
expect(sl.isValid(profile, desktop)).toBeTruthy(); | ||
expect(sl.isValid(profile, mobile)).toBeTruthy(); | ||
expect(sl.getProfileId(profile, desktop)).toBe(profileId); | ||
expect(sl.getProfileId(profile, mobile)).toBe(profileId); | ||
expect(sl.getLink(profile, profileId)).toBe(desktop); | ||
expect(sl.getLink(profile, profileId, main_1.TYPE_DESKTOP)).toBe(desktop); | ||
expect(sl.getLink(profile, profileId, main_1.TYPE_MOBILE)).toBe(mobile); | ||
expect(sl.sanitize(profile, desktop)).toBe(desktop); | ||
expect(sl.sanitize(profile, desktop, main_1.TYPE_DESKTOP)).toBe(desktop); | ||
expect(sl.sanitize(profile, mobile, main_1.TYPE_MOBILE)).toBe(mobile); | ||
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); | ||
}; | ||
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 youtube', function () { | ||
var profile = 'youtube'; | ||
var profileId = 'UCpHGx5iSfXZ-7AicGd6IZtg'; | ||
var desktop = "https://youtube.com/channel/" + profileId; | ||
var mobile = "https://m.youtube.com/c/" + profileId; | ||
testProfile(profile, profileId, desktop, mobile); | ||
var profileId = 'gkucmierz'; | ||
var oldChannel = "https://youtube.com/channel/" + profileId; | ||
var user = "https://youtube.com/user/" + profileId; | ||
testProfile(profile, profileId, oldChannel, user); | ||
testProfile(profile, profileId, user, user); | ||
}); | ||
}); | ||
//# sourceMappingURL=youtube.spec.js.map |
{ | ||
"name": "social-links", | ||
"version": "1.8.1", | ||
"version": "1.9.0", | ||
"description": "Validate & sanitize social links", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
172972
2023