1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

Add an unit test for findNoteTitle

This commit is contained in:
asmsuechan
2017-05-04 10:45:19 -07:00
parent 0bc9c6fb5a
commit ffc4ca1dd4

View File

@@ -0,0 +1,22 @@
/**
* @fileoverview Unit test for browser/lib/findTitle
*/
const test = require('ava')
const findNoteTitle = require('browser/lib/findNoteTitle')
// Unit test
test('findNoteTitle#find should return a correct title (string)', t => {
// [input, expected]
const testCases = [
['# hoge\nhoge', 'hoge'],
['# hoge_hoge_hoge', 'hoge_hoge_hoge'],
['```\n# hoge\n```\n# fuga', 'fuga']
]
testCases.forEach(testCase => {
const [input, expected] = testCase
t.is(findNoteTitle.find(input), expected, `Test for find() input: ${input} expected: ${expected}`)
})
})