From fbdaf8bbef166c894350c67ef112e28fd020c17c Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Mon, 30 Jan 2023 10:36:39 +0100 Subject: [PATCH] chore: cleanup --- tests/__snapshots__/content-rich.test.ts.snap | 164 ------------------ tests/__snapshots__/html-parse.test.ts.snap | 144 --------------- tests/nuxt/content-rich.test.ts | 13 +- 3 files changed, 4 insertions(+), 317 deletions(-) delete mode 100644 tests/__snapshots__/content-rich.test.ts.snap delete mode 100644 tests/__snapshots__/html-parse.test.ts.snap diff --git a/tests/__snapshots__/content-rich.test.ts.snap b/tests/__snapshots__/content-rich.test.ts.snap deleted file mode 100644 index 289bfb73..00000000 --- a/tests/__snapshots__/content-rich.test.ts.snap +++ /dev/null @@ -1,164 +0,0 @@ -// Vitest Snapshot v1 - -exports[`content-rich > block with backticks 1`] = `"

[(\`number string) (\`tag string)]

"`; - -exports[`content-rich > block with injected html, with a known language 1`] = ` -"
-        
-          <a href="javascript:alert(1)">click me</a>
-        
-      
-" -`; - -exports[`content-rich > block with injected html, with an unknown language 1`] = ` -"
-        
-          <a href="javascript:alert(1)">click me</a>
-        
-      
-" -`; - -exports[`content-rich > block with injected html, without language 1`] = ` -"
-        
-          <a href="javascript:alert(1)">click me</a>
-        
-      
-" -`; - -exports[`content-rich > code frame 1`] = ` -"

Testing code block

import { useMouse, usePreferredDark } from '@vueuse/core'
-// tracks mouse position
-const { x, y } = useMouse()
-// is the user prefers dark theme
-const isDark = usePreferredDark()

" -`; - -exports[`content-rich > code frame 2 1`] = ` -"

- - Testing
-

const a = hello
-

-" -`; - -exports[`content-rich > code frame empty 1`] = `"


"`; - -exports[`content-rich > code frame no lang 1`] = `"

hello world

no lang

"`; - -exports[`content-rich > custom emoji 1`] = ` -"Daniel Roe - - \\":nuxt:\\" -" -`; - -exports[`content-rich > empty 1`] = `""`; - -exports[`content-rich > group mention > html 1`] = ` -"

- -

-" -`; - -exports[`content-rich > handles formatting from servers 1`] = ` -"

Fedi HTML Support Survey

-

Does the following formatting come through accurately for you?

-

- -
    -
  1. This list...
  2. -
  3. ...is numbered and indented
  4. -
-

This line is larger.

-" -`; - -exports[`content-rich > handles html within code blocks 1`] = ` -"

- HTML block code:
-

-<span class="icon--noto icon--noto--1st-place-medal"></span>
-<span class="icon--noto icon--noto--2nd-place-medal-medal"></span>
-

-" -`; - -exports[`content-rich > inline code with link 1`] = ` -"

- Inline code with link: - https://api.iconify.design/noto.css?icons=1st-place-medal,2nd-place-medal -

-" -`; - -exports[`content-rich > link + mention 1`] = ` -"

- Happy - \\"πŸ€—\\" - we’re now using - - (migrated from chai+mocha) - https://github.com/ayoayco/astro-reactive-library/pull/203 -

-" -`; - -exports[`content-rich > plain text 1`] = ` -"hello there -" -`; - -exports[`editor > transform mentions 1`] = ` -" -@elk Hello" -`; diff --git a/tests/__snapshots__/html-parse.test.ts.snap b/tests/__snapshots__/html-parse.test.ts.snap deleted file mode 100644 index d7f36a0d..00000000 --- a/tests/__snapshots__/html-parse.test.ts.snap +++ /dev/null @@ -1,144 +0,0 @@ -// Vitest Snapshot v1 - -exports[`html-parse > code frame > html 1`] = ` -"

Testing code block

import { useMouse, usePreferredDark } from '@vueuse/core'
-// tracks mouse position
-const { x, y } = useMouse()
-// is the user prefers dark theme
-const isDark = usePreferredDark()

" -`; - -exports[`html-parse > code frame > text 1`] = ` -"Testing code block - - -\`\`\`ts -import { useMouse, usePreferredDark } from '@vueuse/core' -// tracks mouse position -const { x, y } = useMouse() -// is the user prefers dark theme -const isDark = usePreferredDark() -\`\`\`" -`; - -exports[`html-parse > code frame 2 > html 1`] = ` -"

- @antfu - Testing
-

const a = hello
-

-" -`; - -exports[`html-parse > code frame 2 > text 1`] = ` -"@antfu Testing - -\`\`\`ts -const a = hello -\`\`\`" -`; - -exports[`html-parse > custom emoji > html 1`] = ` -"Daniel Roe - - \\":nuxt:\\" -" -`; - -exports[`html-parse > custom emoji > text 1`] = `"Daniel Roe :nuxt:"`; - -exports[`html-parse > emojis > html 1`] = ` -"\\"πŸ‡«πŸ‡·\\" -\\"πŸ‘¨β€πŸ‘©β€πŸ‘¦\\" -\\"πŸ‘©β€πŸš’\\"\\"πŸ§‘πŸ½β€πŸš€\\" -" -`; - -exports[`html-parse > emojis > text 1`] = `"πŸ‡«πŸ‡· πŸ‘¨β€πŸ‘©β€πŸ‘¦ πŸ‘©β€πŸš’πŸ§‘πŸ½β€πŸš€"`; - -exports[`html-parse > empty > html 1`] = `""`; - -exports[`html-parse > empty > text 1`] = `""`; - -exports[`html-parse > html entities > html 1`] = ` -"

Hello <World />.

-" -`; - -exports[`html-parse > html entities > text 1`] = `"Hello ."`; - -exports[`html-parse > inline markdown > html 1`] = `"

text code bold italic del

code block

"`; - -exports[`html-parse > inline markdown > text 1`] = ` -"text \`code\` **bold** *italic* ~~del~~ - - -\`\`\`js -code block -\`\`\`" -`; - -exports[`html-parse > link + mention > html 1`] = ` -"

- Happy - \\"πŸ€—\\" - we’re now using - @vitest - (migrated from chai+mocha) - https://github.com/ayoayco/astro-reactive-library/pull/203 -

-" -`; - -exports[`html-parse > link + mention > text 1`] = `"Happy πŸ€— we’re now using @vitest (migrated from chai+mocha) https://github.com/ayoayco/astro-reactive-library/pull/203"`; diff --git a/tests/nuxt/content-rich.test.ts b/tests/nuxt/content-rich.test.ts index 9d32b592..d21bc30e 100644 --- a/tests/nuxt/content-rich.test.ts +++ b/tests/nuxt/content-rich.test.ts @@ -287,15 +287,10 @@ vi.mock('shiki-es', async (importOriginal) => { } }) -vi.mock('~/components/content/ContentMentionGroup.vue', async () => { - const { defineComponent, h } = await import('vue') - return { - default: defineComponent({ - setup(props, { slots }) { - return () => h('mention-group', null, { default: () => slots?.default?.() }) - }, - }), - } +mockComponent('ContentMentionGroup', { + setup(props, { slots }) { + return () => h('mention-group', null, { default: () => slots?.default?.() }) + }, }) mockComponent('AccountHoverWrapper', {