about summary refs log tree commit diff
path: root/__tests__/lib/extractHtmlMeta.test.ts
diff options
context:
space:
mode:
Diffstat (limited to '__tests__/lib/extractHtmlMeta.test.ts')
-rw-r--r--__tests__/lib/extractHtmlMeta.test.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/__tests__/lib/extractHtmlMeta.test.ts b/__tests__/lib/extractHtmlMeta.test.ts
index 18a0df4c7..cdd2a3384 100644
--- a/__tests__/lib/extractHtmlMeta.test.ts
+++ b/__tests__/lib/extractHtmlMeta.test.ts
@@ -1,7 +1,8 @@
-import {extractHtmlMeta} from '../../src/lib/extractHtmlMeta'
+import {extractHtmlMeta} from '../../src/lib/link-meta/html'
 import {exampleComHtml} from './__mocks__/exampleComHtml'
 import {youtubeHTML} from './__mocks__/youtubeHtml'
 import {tiktokHtml} from './__mocks__/tiktokHtml'
+import {youtubeChannelHtml} from './__mocks__/youtubeChannelHtml'
 
 describe('extractHtmlMeta', () => {
   const cases = [
@@ -82,6 +83,19 @@ describe('extractHtmlMeta', () => {
     expect(output).toEqual(expectedOutput)
   })
 
+  it('extracts avatar from a youtube channel', () => {
+    const input = youtubeChannelHtml
+    const expectedOutput = {
+      title: 'penguinz0',
+      description:
+        'Clips channel: https://www.youtube.com/channel/UC4EQHfzIbkL_Skit_iKt1aA\n\nTwitter:     https://twitter.com/MoistCr1TiKaL\n\nInstagram:    https://www.instagram.com/bigmoistcr1tikal/?hl=en\n\nTwitch: https://www.twitch.tv/moistcr1tikal\n\nSnapchat: Hugecharles\n\nTik Tok: Hugecharles\n\nI don't have any other public accounts.',
+      image:
+        'https://yt3.googleusercontent.com/ytc/AL5GRJWOhJOuUC6C2b7gP-5D2q6ypXbcOOckyAE1En4RUQ=s176-c-k-c0x00ffffff-no-rj',
+    }
+    const output = extractHtmlMeta({html: input, hostname: 'youtube.com'})
+    expect(output).toEqual(expectedOutput)
+  })
+
   it('extracts username from the url a twitter profile page', () => {
     const expectedOutput = {
       title: '@bluesky on Twitter',