mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-15 02:36:36 +00:00
rename files to suit Jest
This commit is contained in:
46
tests/lib/markdown-text-helper.test.js
Normal file
46
tests/lib/markdown-text-helper.test.js
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @fileoverview Unit test for browser/lib/markdown
|
||||
*/
|
||||
const markdown = require('browser/lib/markdownTextHelper')
|
||||
|
||||
test(() => {
|
||||
// [input, expected]
|
||||
const testCases = [
|
||||
// List
|
||||
[' - ', ' '],
|
||||
[' + ', ' '],
|
||||
[' * ', ' '],
|
||||
[' * ', ' '],
|
||||
[' 1. ', ' '],
|
||||
[' 2. ', ' '],
|
||||
[' 10. ', ' '],
|
||||
['\t- ', '\t'],
|
||||
['- ', ''],
|
||||
// Header with using line
|
||||
['\n==', '\n'],
|
||||
['\n===', '\n'],
|
||||
['test\n===', 'test\n'],
|
||||
// Code block
|
||||
['```test\n', ''],
|
||||
['```test\nhoge', 'hoge'],
|
||||
// HTML tag
|
||||
['<>', ''],
|
||||
['<test>', 'test'],
|
||||
['hoge<test>', 'hogetest'],
|
||||
['<test>moge', 'testmoge'],
|
||||
// Emphasis
|
||||
['~~', ''],
|
||||
['~~text~~', 'text'],
|
||||
// Don't remove underscore
|
||||
['`MY_TITLE`', 'MY_TITLE'],
|
||||
['MY_TITLE', 'MY_TITLE'],
|
||||
// I have no idea for it...
|
||||
['```test', '`test'],
|
||||
['# C# Features', 'C# Features']
|
||||
]
|
||||
|
||||
testCases.forEach(testCase => {
|
||||
const [input, expected] = testCase
|
||||
expect(markdown.strip(input)).toBe(expected)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user