Skip to content

Commit a01f594

Browse files
committed
test: add transformMarkdown test
1 parent 8860b44 commit a01f594

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

test/cli.test.js

+26-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { fileURLToPath } from 'node:url'
1818
import net from 'node:net'
1919
import getPort from 'get-port'
2020
import '../build/globals.js'
21-
import { isMain, normalizeExt } from '../build/cli.js'
21+
import { isMain, normalizeExt, transformMarkdown } from '../build/cli.js'
2222

2323
const __filename = fileURLToPath(import.meta.url)
2424
const spawn = $.spawn
@@ -283,12 +283,31 @@ describe('cli', () => {
283283
assert.ok(['EACCES', 'ENOENT'].includes(e.code))
284284
}
285285
})
286-
})
287286

288-
test('normalizeExt()', () => {
289-
assert.equal(normalizeExt('.ts'), '.ts')
290-
assert.equal(normalizeExt('ts'), '.ts')
291-
assert.equal(normalizeExt('.'), '.')
292-
assert.equal(normalizeExt(), undefined)
287+
test('transformMarkdown()', () => {
288+
// prettier-ignore
289+
assert.equal(transformMarkdown(`
290+
# Title
291+
292+
~~~js
293+
await $\`echo "tilde"\`
294+
~~~
295+
296+
`), `//
297+
// # Title
298+
//
299+
300+
await $\`echo "tilde"\`
301+
302+
//
303+
// `)
304+
})
305+
306+
test('normalizeExt()', () => {
307+
assert.equal(normalizeExt('.ts'), '.ts')
308+
assert.equal(normalizeExt('ts'), '.ts')
309+
assert.equal(normalizeExt('.'), '.')
310+
assert.equal(normalizeExt(), undefined)
311+
})
293312
})
294313
})

0 commit comments

Comments
 (0)