mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
Add test
This commit is contained in:
@@ -6,26 +6,30 @@ import _ from 'lodash'
|
||||
const pickContents = (notes) => notes.map((note) => { return note.content })
|
||||
|
||||
let notes = []
|
||||
let note1, note2
|
||||
let note1, note2, note3
|
||||
|
||||
test.before(t => {
|
||||
const data1 = { type: 'MARKDOWN_NOTE', content: 'content1', tags: ['tag1'] }
|
||||
const data2 = { type: 'MARKDOWN_NOTE', content: 'content1\ncontent2', tags: ['tag1', 'tag2'] }
|
||||
const data3 = { type: 'MARKDOWN_NOTE', content: '#content4', tags: ['tag1'] }
|
||||
|
||||
note1 = dummyNote(data1)
|
||||
note2 = dummyNote(data2)
|
||||
note3 = dummyNote(data3)
|
||||
|
||||
notes = [note1, note2]
|
||||
notes = [note1, note2, note3]
|
||||
})
|
||||
|
||||
test('it can find notes by tags or words', t => {
|
||||
// [input, expected content (Array)]
|
||||
const testCases = [
|
||||
['#tag1', [note1.content, note2.content]],
|
||||
['#tag1', [note1.content, note2.content, note3.content]],
|
||||
['#tag1 #tag2', [note2.content]],
|
||||
['#tag1 #tag2 #tag3', []],
|
||||
['content1', [note1.content, note2.content]],
|
||||
['content1 content2', [note2.content]],
|
||||
['content1 content2 content3', []]
|
||||
['content1 content2 content3', []],
|
||||
['#content4', [note3.content]]
|
||||
]
|
||||
|
||||
testCases.forEach((testCase) => {
|
||||
|
||||
Reference in New Issue
Block a user