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

Add test: find tags without hash symbol

Searching has to find tags without hash symbol too (`tag` instead of
`#tag`).
This commit is contained in:
bimlas
2018-03-21 20:00:02 +01:00
parent 4f9a0b0040
commit 145ae10a79

View File

@@ -22,7 +22,7 @@ test.before(t => {
test('it can find notes by tags and words', t => {
// [input, expected content (Array)]
const testCases = [
const testWithTags = [
['#tag1', [note1.content, note2.content, note3.content]],
['#tag1 #tag2', [note2.content]],
['#tag2 #tag1', [note2.content]],
@@ -34,7 +34,11 @@ test('it can find notes by tags and words', t => {
['#tag2 content1', [note2.content]],
['content1 #tag2', [note2.content]]
]
const testWithTagsWithoutHash = testWithTags.map(function (testCase) {
return [testCase[0].replace(/#/g, ''), testCase[1]]
})
const testCases = testWithTags.concat(testWithTagsWithoutHash)
testCases.forEach((testCase) => {
const [input, expectedContents] = testCase
const results = searchFromNotes(notes, input)