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

fixed eslint error & integrated with prettier as well as formatted the whole codebase (#3450)

This commit is contained in:
Nguyen Viet Hung
2020-02-05 13:28:27 +13:00
committed by GitHub
parent 051ce9e208
commit 592aca1539
186 changed files with 9233 additions and 5565 deletions

View File

@@ -3,14 +3,21 @@ import searchFromNotes from 'browser/lib/search'
import { dummyNote } from '../fixtures/TestDummy'
import _ from 'lodash'
const pickContents = (notes) => notes.map((note) => { return note.content })
const pickContents = notes =>
notes.map(note => {
return note.content
})
let notes = []
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 data2 = {
type: 'MARKDOWN_NOTE',
content: 'content1\ncontent2',
tags: ['tag1', 'tag2']
}
const data3 = { type: 'MARKDOWN_NOTE', content: '#content4', tags: ['tag1'] }
note1 = dummyNote(data1)
@@ -34,12 +41,12 @@ test('it can find notes by tags and words', t => {
['#tag2 content1', [note2.content]],
['content1 #tag2', [note2.content]]
]
const testWithTagsWithoutHash = testWithTags.map(function (testCase) {
const testWithTagsWithoutHash = testWithTags.map(function(testCase) {
return [testCase[0].replace(/#/g, ''), testCase[1]]
})
const testCases = testWithTags.concat(testWithTagsWithoutHash)
testCases.forEach((testCase) => {
testCases.forEach(testCase => {
const [input, expectedContents] = testCase
const results = searchFromNotes(notes, input)
t.true(_.isEqual(pickContents(results).sort(), expectedContents.sort()))