mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 01:35:18 -04:00
refactor(frontend/commons): rename .test files to .spec
Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
24b7514e25
commit
4956a99ced
144 changed files with 84 additions and 84 deletions
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { replaceAsciinemaLinkMarkdownItPlugin } from './replace-asciinema-link'
|
||||
import MarkdownIt from 'markdown-it/lib'
|
||||
|
||||
describe('Replace asciinema link', () => {
|
||||
let markdownIt: MarkdownIt
|
||||
|
||||
beforeEach(() => {
|
||||
markdownIt = new MarkdownIt('default', {
|
||||
html: false,
|
||||
breaks: true,
|
||||
langPrefix: '',
|
||||
typographer: true
|
||||
})
|
||||
markdownIt.use(replaceAsciinemaLinkMarkdownItPlugin)
|
||||
})
|
||||
|
||||
it('will replace a valid URL', () => {
|
||||
expect(markdownIt.renderInline('https://asciinema.org/a/123981234')).toBe(
|
||||
`<app-asciinema id='123981234'></app-asciinema>`
|
||||
)
|
||||
})
|
||||
|
||||
it('will replace a valid URL with appendix', () => {
|
||||
expect(markdownIt.renderInline('https://asciinema.org/a/123981234?a=1')).toBe(
|
||||
`<app-asciinema id='123981234'></app-asciinema>`
|
||||
)
|
||||
})
|
||||
|
||||
it("won't replace an URL without path", () => {
|
||||
expect(markdownIt.renderInline('https://asciinema.org/123981234')).toBe(`https://asciinema.org/123981234`)
|
||||
})
|
||||
|
||||
it("won't replace an URL with non-numeric id", () => {
|
||||
expect(markdownIt.renderInline('https://asciinema.org/a/12f3981234')).toBe(`https://asciinema.org/a/12f3981234`)
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue