Skip to content

Commit

Permalink
test: add transformMarkdown test
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Dec 21, 2024
1 parent 8860b44 commit a01f594
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { fileURLToPath } from 'node:url'
import net from 'node:net'
import getPort from 'get-port'
import '../build/globals.js'
import { isMain, normalizeExt } from '../build/cli.js'
import { isMain, normalizeExt, transformMarkdown } from '../build/cli.js'

const __filename = fileURLToPath(import.meta.url)
const spawn = $.spawn
Expand Down Expand Up @@ -283,12 +283,31 @@ describe('cli', () => {
assert.ok(['EACCES', 'ENOENT'].includes(e.code))
}
})
})

test('normalizeExt()', () => {
assert.equal(normalizeExt('.ts'), '.ts')
assert.equal(normalizeExt('ts'), '.ts')
assert.equal(normalizeExt('.'), '.')
assert.equal(normalizeExt(), undefined)
test('transformMarkdown()', () => {
// prettier-ignore
assert.equal(transformMarkdown(`
# Title
~~~js
await $\`echo "tilde"\`
~~~
`), `//
// # Title
//
await $\`echo "tilde"\`
//
// `)
})

test('normalizeExt()', () => {
assert.equal(normalizeExt('.ts'), '.ts')
assert.equal(normalizeExt('ts'), '.ts')
assert.equal(normalizeExt('.'), '.')
assert.equal(normalizeExt(), undefined)
})
})
})

0 comments on commit a01f594

Please sign in to comment.