1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-14 02:06:29 +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

@@ -4,8 +4,42 @@ const { parse } = require('browser/lib/RcParser')
// Unit test
test('RcParser should return a json object', t => {
const validJson = { 'editor': { 'keyMap': 'vim', 'switchPreview': 'BLUR', 'theme': 'monokai' }, 'hotkey': { 'toggleMain': 'Control + L' }, 'listWidth': 135, 'navWidth': 135 }
const allJson = { 'amaEnabled': true, 'editor': { 'fontFamily': 'Monaco, Consolas', 'fontSize': '14', 'indentSize': '2', 'indentType': 'space', 'keyMap': 'vim', 'switchPreview': 'BLUR', 'theme': 'monokai' }, 'hotkey': { 'toggleMain': 'Cmd + Alt + L' }, 'isSideNavFolded': false, 'listStyle': 'DEFAULT', 'listWidth': 174, 'navWidth': 200, 'preview': { 'codeBlockTheme': 'dracula', 'fontFamily': 'Lato', 'fontSize': '14', 'lineNumber': true }, 'sortBy': { 'default': 'UPDATED_AT' }, 'ui': { 'defaultNote': 'ALWAYS_ASK', 'disableDirectWrite': false, 'theme': 'default' }, 'zoom': 1 }
const validJson = {
editor: { keyMap: 'vim', switchPreview: 'BLUR', theme: 'monokai' },
hotkey: { toggleMain: 'Control + L' },
listWidth: 135,
navWidth: 135
}
const allJson = {
amaEnabled: true,
editor: {
fontFamily: 'Monaco, Consolas',
fontSize: '14',
indentSize: '2',
indentType: 'space',
keyMap: 'vim',
switchPreview: 'BLUR',
theme: 'monokai'
},
hotkey: { toggleMain: 'Cmd + Alt + L' },
isSideNavFolded: false,
listStyle: 'DEFAULT',
listWidth: 174,
navWidth: 200,
preview: {
codeBlockTheme: 'dracula',
fontFamily: 'Lato',
fontSize: '14',
lineNumber: true
},
sortBy: { default: 'UPDATED_AT' },
ui: {
defaultNote: 'ALWAYS_ASK',
disableDirectWrite: false,
theme: 'default'
},
zoom: 1
}
// [input, expected]
const validTestCases = [
@@ -13,21 +47,27 @@ test('RcParser should return a json object', t => {
['.boostnoterc.all', allJson]
]
const invalidTestCases = [
['.boostnoterc.invalid', {}]
]
const invalidTestCases = [['.boostnoterc.invalid', {}]]
validTestCases.forEach(validTestCase => {
const [input, expected] = validTestCase
t.is(parse(filePath(input)).editor.keyMap, expected.editor.keyMap, `Test for getTodoStatus() input: ${input} expected: ${expected.keyMap}`)
t.is(
parse(filePath(input)).editor.keyMap,
expected.editor.keyMap,
`Test for getTodoStatus() input: ${input} expected: ${expected.keyMap}`
)
})
invalidTestCases.forEach(invalidTestCase => {
const [input, expected] = invalidTestCase
t.is(parse(filePath(input)).editor, expected.editor, `Test for getTodoStatus() input: ${input} expected: ${expected.editor}`)
t.is(
parse(filePath(input)).editor,
expected.editor,
`Test for getTodoStatus() input: ${input} expected: ${expected.editor}`
)
})
})
function filePath (filename) {
function filePath(filename) {
return path.join(`${__dirname}/boostnoterc`, filename)
}