style: apply prettier across fork files
check:prettier was not part of my gate routine, so formatting drift accumulated across the session's touched files (and a few older ones). Run prettier --write to bring the repo back to 'All matched files use Prettier code style!'. Formatting only — no logic changes. tsc/tests/build all green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -50,7 +50,9 @@ test('Vimeo (incl. unlisted hash + channel/group/album forms)', () => {
|
||||
id: '123456789',
|
||||
hash: 'abc123',
|
||||
});
|
||||
assert.ok(parseMediaEmbed('https://vimeo.com/123456789/abc123', 'h')?.embedUrl.includes('h=abc123'));
|
||||
assert.ok(
|
||||
parseMediaEmbed('https://vimeo.com/123456789/abc123', 'h')?.embedUrl.includes('h=abc123'),
|
||||
);
|
||||
// channel / group / album share a trailing numeric video id
|
||||
assert.equal(getVimeoParts('https://vimeo.com/channels/staffpicks/76979871')?.id, '76979871');
|
||||
assert.equal(getVimeoParts('https://vimeo.com/groups/motion/videos/12345')?.id, '12345');
|
||||
@@ -61,7 +63,9 @@ test('extractEmbedHeight: Instagram / Reddit / Twitter shapes', () => {
|
||||
assert.equal(extractEmbedHeight({ type: 'MEASURE', details: { height: 640 } }), 640);
|
||||
assert.equal(extractEmbedHeight({ type: 'resize.embed', data: 812 }), 812); // Reddit
|
||||
assert.equal(
|
||||
extractEmbedHeight({ 'twttr.embed': [{ method: 'twttr.private.resize', params: [{ height: 500 }] }] }),
|
||||
extractEmbedHeight({
|
||||
'twttr.embed': [{ method: 'twttr.private.resize', params: [{ height: 500 }] }],
|
||||
}),
|
||||
500,
|
||||
);
|
||||
assert.equal(extractEmbedHeight({ height: 300 }), 300); // generic fallback
|
||||
@@ -74,7 +78,10 @@ test('mobile Shorts (m.youtube.com) → portrait', () => {
|
||||
});
|
||||
|
||||
test('TikTok: canonical /video/<id> only', () => {
|
||||
assert.equal(getTikTokVideoId('https://www.tiktok.com/@user/video/7234567890123456789'), '7234567890123456789');
|
||||
assert.equal(
|
||||
getTikTokVideoId('https://www.tiktok.com/@user/video/7234567890123456789'),
|
||||
'7234567890123456789',
|
||||
);
|
||||
assert.equal(getTikTokVideoId('https://vm.tiktok.com/ZMabc/'), null); // short link → oEmbed
|
||||
assert.equal(getTikTokVideoId('https://www.tiktok.com/@user'), null);
|
||||
});
|
||||
@@ -89,10 +96,16 @@ test('isTikTokLink: canonical + short + vm/vt', () => {
|
||||
});
|
||||
|
||||
test('tiktokIdFromOembed + player url', () => {
|
||||
assert.equal(tiktokIdFromOembed({ embed_product_id: '7659555276823006478' }), '7659555276823006478');
|
||||
assert.equal(
|
||||
tiktokIdFromOembed({ embed_product_id: '7659555276823006478' }),
|
||||
'7659555276823006478',
|
||||
);
|
||||
assert.equal(tiktokIdFromOembed({ html: '<blockquote data-video-id="123456">' }), '123456');
|
||||
assert.equal(tiktokIdFromOembed({}), null);
|
||||
assert.equal(tiktokPlayerEmbedUrl('999'), 'https://www.tiktok.com/player/v1/999?autoplay=1&rel=0');
|
||||
assert.equal(
|
||||
tiktokPlayerEmbedUrl('999'),
|
||||
'https://www.tiktok.com/player/v1/999?autoplay=1&rel=0',
|
||||
);
|
||||
});
|
||||
|
||||
test('Dailymotion + Streamable', () => {
|
||||
@@ -203,16 +216,28 @@ test('Tidal: track (audio) vs video (landscape)', () => {
|
||||
embedUrl: 'https://embed.tidal.com/tracks/12345',
|
||||
height: 120,
|
||||
});
|
||||
assert.equal(getTidalEmbed('https://listen.tidal.com/album/999')?.embedUrl, 'https://embed.tidal.com/albums/999?layout=gridify');
|
||||
assert.equal(
|
||||
getTidalEmbed('https://listen.tidal.com/album/999')?.embedUrl,
|
||||
'https://embed.tidal.com/albums/999?layout=gridify',
|
||||
);
|
||||
assert.equal(getTidalEmbed('https://listen.tidal.com/album/999')?.height, 275);
|
||||
assert.equal(getTidalEmbed('https://tidal.com/video/555')?.kind, 'landscape');
|
||||
assert.equal(getTidalEmbed('https://tidal.com/browse'), null);
|
||||
});
|
||||
|
||||
test('Instagram: p / reel / tv → embed path', () => {
|
||||
assert.equal(getInstagramEmbed('https://www.instagram.com/p/AbC123_-/'), 'https://www.instagram.com/p/AbC123_-/embed/');
|
||||
assert.equal(getInstagramEmbed('https://instagram.com/reel/XyZ/'), 'https://www.instagram.com/reel/XyZ/embed/');
|
||||
assert.equal(getInstagramEmbed('https://www.instagram.com/reels/XyZ/'), 'https://www.instagram.com/reel/XyZ/embed/');
|
||||
assert.equal(
|
||||
getInstagramEmbed('https://www.instagram.com/p/AbC123_-/'),
|
||||
'https://www.instagram.com/p/AbC123_-/embed/',
|
||||
);
|
||||
assert.equal(
|
||||
getInstagramEmbed('https://instagram.com/reel/XyZ/'),
|
||||
'https://www.instagram.com/reel/XyZ/embed/',
|
||||
);
|
||||
assert.equal(
|
||||
getInstagramEmbed('https://www.instagram.com/reels/XyZ/'),
|
||||
'https://www.instagram.com/reel/XyZ/embed/',
|
||||
);
|
||||
assert.equal(getInstagramEmbed('https://www.instagram.com/someuser/'), null);
|
||||
});
|
||||
|
||||
@@ -221,7 +246,10 @@ test('Reddit post embed → embed.reddit.com', () => {
|
||||
getRedditPostEmbed('https://www.reddit.com/r/aww/comments/abc123/cute_cat/'),
|
||||
'https://embed.reddit.com/r/aww/comments/abc123/?ref_source=embed&ref=share&embed=true&theme=dark',
|
||||
);
|
||||
assert.equal(getRedditPostEmbed('https://old.reddit.com/r/aww/comments/xyz/'), 'https://embed.reddit.com/r/aww/comments/xyz/?ref_source=embed&ref=share&embed=true&theme=dark');
|
||||
assert.equal(
|
||||
getRedditPostEmbed('https://old.reddit.com/r/aww/comments/xyz/'),
|
||||
'https://embed.reddit.com/r/aww/comments/xyz/?ref_source=embed&ref=share&embed=true&theme=dark',
|
||||
);
|
||||
assert.equal(getRedditPostEmbed('https://www.reddit.com/r/aww/'), null); // subreddit, not a post
|
||||
// redd.it short link / i.redd.it media host can't build the /r/<sub>/comments/<id>
|
||||
// path embed.reddit.com requires (a bare /comments/<id> 404s) → null so the caller's
|
||||
@@ -232,7 +260,10 @@ test('Reddit post embed → embed.reddit.com', () => {
|
||||
|
||||
test('parseMediaEmbed: Instagram/Reddit → rich, Tidal → audio', () => {
|
||||
assert.equal(parseMediaEmbed('https://www.instagram.com/p/abc/', 'h')?.kind, 'rich');
|
||||
assert.equal(parseMediaEmbed('https://www.reddit.com/r/x/comments/y/z/', 'h')?.provider, 'reddit');
|
||||
assert.equal(
|
||||
parseMediaEmbed('https://www.reddit.com/r/x/comments/y/z/', 'h')?.provider,
|
||||
'reddit',
|
||||
);
|
||||
assert.equal(parseMediaEmbed('https://tidal.com/browse/track/1', 'h')?.provider, 'tidal');
|
||||
});
|
||||
|
||||
@@ -242,7 +273,10 @@ test('Bluesky / Loom / Kick', () => {
|
||||
'https://embed.bsky.app/embed/alice.bsky.social/app.bsky.feed.post/3kabc',
|
||||
);
|
||||
assert.equal(getBlueskyEmbed('https://bsky.app/profile/alice.bsky.social'), null);
|
||||
assert.equal(parseMediaEmbed('https://bsky.app/profile/a.bsky.social/post/3k', 'h')?.kind, 'rich');
|
||||
assert.equal(
|
||||
parseMediaEmbed('https://bsky.app/profile/a.bsky.social/post/3k', 'h')?.kind,
|
||||
'rich',
|
||||
);
|
||||
|
||||
assert.equal(getLoomId('https://www.loom.com/share/abc123DEF'), 'abc123DEF');
|
||||
assert.equal(getLoomId('https://www.loom.com/embed/abc123DEF'), 'abc123DEF');
|
||||
|
||||
Reference in New Issue
Block a user