about summary refs log tree commit diff
path: root/__tests__/lib/extractMetaHtml.test.ts
diff options
context:
space:
mode:
authorAryan Goharzad <arrygoo@gmail.com>2023-01-20 13:54:30 -0500
committerGitHub <noreply@github.com>2023-01-20 12:54:30 -0600
commit2fce1637b4ae01667da8ceafaa07a6266ab88450 (patch)
tree88b50722379bf004df0219b49e04b770afd2b8b8 /__tests__/lib/extractMetaHtml.test.ts
parentd4b9ef3b0a89f1a5a97ff37024fe7f8d90891b86 (diff)
downloadvoidsky-2fce1637b4ae01667da8ceafaa07a6266ab88450.tar.zst
Fixes embed links for twitter and tiktok (#74)
Diffstat (limited to '__tests__/lib/extractMetaHtml.test.ts')
-rw-r--r--__tests__/lib/extractMetaHtml.test.ts70
1 files changed, 0 insertions, 70 deletions
diff --git a/__tests__/lib/extractMetaHtml.test.ts b/__tests__/lib/extractMetaHtml.test.ts
deleted file mode 100644
index 10020f3a9..000000000
--- a/__tests__/lib/extractMetaHtml.test.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-import {extractHtmlMeta} from '../../src/lib/extractHtmlMeta'
-import {exampleComHtml} from './__mocks__/exampleComHtml'
-import {youtubeHTML} from './__mocks__/youtubeHtml'
-
-describe('extractHtmlMeta', () => {
-  const cases = [
-    ['', {}],
-    ['nothing', {}],
-    ['<title>title</title>', {title: 'title'}],
-    ['<title> aSd!@#AC </title>', {title: 'aSd!@#AC'}],
-    ['<title>\n  title\n  </title>', {title: 'title'}],
-    ['<meta name="title" content="meta title">', {title: 'meta title'}],
-    [
-      '<meta name="description" content="meta description">',
-      {description: 'meta description'},
-    ],
-    ['<meta property="og:title" content="og title">', {title: 'og title'}],
-    [
-      '<meta property="og:description" content="og description">',
-      {description: 'og description'},
-    ],
-    [
-      '<meta property="og:image" content="https://ogimage.com/foo.png">',
-      {image: 'https://ogimage.com/foo.png'},
-    ],
-    [
-      '<meta property="twitter:title" content="twitter title">',
-      {title: 'twitter title'},
-    ],
-    [
-      '<meta property="twitter:description" content="twitter description">',
-      {description: 'twitter description'},
-    ],
-    [
-      '<meta property="twitter:image" content="https://twitterimage.com/foo.png">',
-      {image: 'https://twitterimage.com/foo.png'},
-    ],
-    ['<meta\n  name="title"\n  content="meta title"\n>', {title: 'meta title'}],
-  ]
-
-  it.each(cases)(
-    'given the html tag %p, returns %p',
-    (input, expectedResult) => {
-      const output = extractHtmlMeta({html: input as string, hostname: ''})
-      expect(output).toEqual(expectedResult)
-    },
-  )
-
-  it('extracts title and description from a generic HTML page', () => {
-    const input = exampleComHtml
-    const expectedOutput = {
-      title: 'Example Domain',
-      description: 'An example website',
-    }
-    const output = extractHtmlMeta({html: input, hostname: 'example.com'})
-    expect(output).toEqual(expectedOutput)
-  })
-
-  it('extracts title and description from a generic youtube page', () => {
-    const input = youtubeHTML
-    const expectedOutput = {
-      title: 'HD Video (1080p) with Relaxing Music of Native American Shamans',
-      description:
-        'Stunning HD Video ( 1080p ) of Patagonian Nature with Relaxing Native American Shamanic Music. HD footage used from ',
-      image: 'https://i.ytimg.com/vi/x6UITRjhijI/sddefault.jpg',
-    }
-    const output = extractHtmlMeta({html: input, hostname: 'youtube.com'})
-    expect(output).toEqual(expectedOutput)
-  })
-})