1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

Compare commits

...

31 Commits

Author SHA1 Message Date
ehhc
7f3fdedb5d Update readme.md 2020-06-25 10:03:02 +09:00
ehhc
3a80706938 Update readme.md
Added link to a project developing a mobile version of boostnote
2020-06-25 10:03:02 +09:00
ZeroX-DG
2cf5f8e966 updated slack invite link 2020-06-08 18:48:55 +09:00
ZeroX-DG
4fbbb4651d updated Boostnote name to Boostnote Legacy 2020-05-11 03:44:21 +09:00
Junyoung Choi
137aa692bc Merge pull request #3547 from ZeroX-DG/migrate-to-jest
[WIP] Migrate to jest
2020-05-08 18:49:27 +09:00
ZeroX-DG
634fec39c0 migrate more tests to jest 2020-05-08 20:13:39 +12:00
ZeroX-DG
d269f1e8fd migrate more tests to jest 2020-05-06 14:57:35 +12:00
Junyoung Choi
4b67026bbf Merge pull request #2936 from callumbooth/fix-2903
fixes #2903 - Rearrange layout of columns
2020-04-24 01:04:23 +09:00
Alexander Wolf
8b13ec4f0e Issue 1706 tag rename - finishing #2989 (#3469)
* allow a tag to be renamed and update all notes that use that tag

• repurpose RenameFolderModal.styl to RenameModal so it is more generic

* call handleConfirmButtonClick directly instead of sending through a confirm method

* better name for method to confirm the rename

* use close prop instead of a new method

* use callback ref instead of legacy string refs

* bind the handleChange in the constructor to allow for direct function assignment

* update the tag in the URL upon change

* use the eventEmitter to update the tags in the SnippetNoteDetail header via the TagSelect component

* respect themes when modal is opened

* show error message when trying to rename to an existing tag

* lint fix, const over let

* add missing letter

* fix routing and add merge warning dialog

* fix space-before-parens lint error

* change theming

* add check if tag changed

Co-authored-by: Khaliq Gant <khaliqgant@gmail.com>
2020-04-21 20:55:56 +09:00
Junyoung Choi
7fef7660e4 Add roadmap 2020-04-21 20:45:05 +09:00
Junyoung Choi
01d021cc4c Add boosthub intro 2020-04-21 18:33:57 +09:00
Callum Booth
c355f81525 remove redundant icons 2020-04-20 08:43:01 +01:00
Callum Booth
d138a54dfd fix accidental deletion of rtl state 2020-04-20 08:42:45 +01:00
Callum Booth
a7ead67c2d moves orientation button to view menu 2020-04-18 14:17:08 +01:00
Callum Booth
2f16784a20 Merge branch 'master' of https://github.com/BoostIO/Boostnote into fix-2903 2020-04-18 13:54:27 +01:00
ZeroX-DG
8ca3ba21ee Merge branch 'master' of https://github.com/BoostIO/Boostnote into migrate-to-jest 2020-04-17 21:49:38 +12:00
ZeroX-DG
58ae6419f0 fixed markdown test error 2020-04-17 21:43:05 +12:00
ZeroX-DG
3f320f4337 resolved conflict 2020-04-12 18:45:49 +12:00
amedora
fc08d2f8c3 Merge branch 'master' into migrate-to-jest
# Conflicts:
#	tests/lib/snapshots/markdown-test.js.md
#	tests/lib/snapshots/markdown-test.js.snap
2019-10-14 07:41:19 +09:00
Callum Booth
59e361cb37 move config value into ui 2019-10-09 12:59:53 +01:00
Callum Booth
1993a6588d Cleans up toggle button component 2019-10-09 12:45:52 +01:00
Callum Booth
218fba1aa1 fix formatting 2019-10-09 12:41:26 +01:00
Callum Booth
4de6c69f5d merge from upstream/master 2019-10-08 13:21:56 +01:00
amedora
3921655157 replace the snapshot file 2019-08-07 15:22:27 +09:00
amedora
e4e10d523f fix how handle the storage as context data 2019-08-07 14:52:17 +09:00
amedora
404dddcb86 rename files to suit Jest 2019-08-07 14:28:38 +09:00
amedora
ffb2603485 jest-codemods tests/lib 2019-08-07 14:17:48 +09:00
Callum Booth
ba34458feb changes if state to be more readable 2019-06-10 20:27:55 +01:00
Callum Booth
a2fb50a71c adds destructed fontFamily from props 2019-06-10 19:21:33 +01:00
Callum booth
b15a4007ee merge from master 2019-06-10 19:13:58 +01:00
Callum booth
93f0d3c1cf fixes #2903 - Rearrange layout of columns 2019-03-19 20:39:34 +00:00
34 changed files with 795 additions and 308 deletions

1
.gitignore vendored
View File

@@ -11,3 +11,4 @@ node_modules/*
.idea
.vscode
package-lock.json
config.json

View File

@@ -1240,18 +1240,19 @@ export default class CodeEditor extends React.Component {
}
render() {
const { className, fontSize } = this.props
const fontFamily = normalizeEditorFontFamily(this.props.fontFamily)
const width = this.props.width
const { className, fontSize, fontFamily, width, height } = this.props
const normalisedFontFamily = normalizeEditorFontFamily(fontFamily)
return (
<div
className={className == null ? 'CodeEditor' : `CodeEditor ${className}`}
ref='root'
tabIndex='-1'
style={{
fontFamily,
fontSize: fontSize,
width: width
fontFamily: normalisedFontFamily,
fontSize,
width,
height
}}
onDrop={e => this.handleDropImage(e)}
/>

View File

@@ -16,7 +16,8 @@ class MarkdownSplitEditor extends React.Component {
this.userScroll = true
this.state = {
isSliderFocused: false,
codeEditorWidthInPercent: 50
codeEditorWidthInPercent: 50,
codeEditorHeightInPercent: 50
}
}
@@ -114,22 +115,42 @@ class MarkdownSplitEditor extends React.Component {
handleMouseMove(e) {
if (this.state.isSliderFocused) {
const rootRect = this.refs.root.getBoundingClientRect()
const rootWidth = rootRect.width
const offset = rootRect.left
let newCodeEditorWidthInPercent = ((e.pageX - offset) / rootWidth) * 100
if (this.props.isStacking) {
const rootHeight = rootRect.height
const offset = rootRect.top
let newCodeEditorHeightInPercent =
((e.pageY - offset) / rootHeight) * 100
// limit minSize to 10%, maxSize to 90%
if (newCodeEditorWidthInPercent <= 10) {
newCodeEditorWidthInPercent = 10
// limit minSize to 10%, maxSize to 90%
if (newCodeEditorHeightInPercent <= 10) {
newCodeEditorHeightInPercent = 10
}
if (newCodeEditorHeightInPercent >= 90) {
newCodeEditorHeightInPercent = 90
}
this.setState({
codeEditorHeightInPercent: newCodeEditorHeightInPercent
})
} else {
const rootWidth = rootRect.width
const offset = rootRect.left
let newCodeEditorWidthInPercent = ((e.pageX - offset) / rootWidth) * 100
// limit minSize to 10%, maxSize to 90%
if (newCodeEditorWidthInPercent <= 10) {
newCodeEditorWidthInPercent = 10
}
if (newCodeEditorWidthInPercent >= 90) {
newCodeEditorWidthInPercent = 90
}
this.setState({
codeEditorWidthInPercent: newCodeEditorWidthInPercent
})
}
if (newCodeEditorWidthInPercent >= 90) {
newCodeEditorWidthInPercent = 90
}
this.setState({
codeEditorWidthInPercent: newCodeEditorWidthInPercent
})
}
}
@@ -154,6 +175,7 @@ class MarkdownSplitEditor extends React.Component {
storageKey,
noteKey,
linesHighlighted,
isStacking,
RTL
} = this.props
let storage
@@ -162,14 +184,62 @@ class MarkdownSplitEditor extends React.Component {
} catch (e) {
return <div />
}
let editorStyle = {}
let previewStyle = {}
let sliderStyle = {}
let editorFontSize = parseInt(config.editor.fontSize, 10)
if (!(editorFontSize > 0 && editorFontSize < 101)) editorFontSize = 14
editorStyle.fontSize = editorFontSize
let editorIndentSize = parseInt(config.editor.indentSize, 10)
if (!(editorFontSize > 0 && editorFontSize < 132)) editorIndentSize = 4
const previewStyle = {}
previewStyle.width = 100 - this.state.codeEditorWidthInPercent + '%'
if (!(editorStyle.fontSize > 0 && editorStyle.fontSize < 132))
editorIndentSize = 4
editorStyle.indentSize = editorIndentSize
editorStyle = Object.assign(
editorStyle,
isStacking
? {
width: '100%',
height: `${this.state.codeEditorHeightInPercent}%`
}
: {
width: `${this.state.codeEditorWidthInPercent}%`,
height: '100%'
}
)
previewStyle = Object.assign(
previewStyle,
isStacking
? {
width: '100%',
height: `${100 - this.state.codeEditorHeightInPercent}%`
}
: {
width: `${100 - this.state.codeEditorWidthInPercent}%`,
height: '100%'
}
)
sliderStyle = Object.assign(
sliderStyle,
isStacking
? {
left: 0,
top: `${this.state.codeEditorHeightInPercent}%`
}
: {
left: `${this.state.codeEditorWidthInPercent}%`,
top: 0
}
)
if (this.props.ignorePreviewPointerEvents || this.state.isSliderFocused)
previewStyle.pointerEvents = 'none'
return (
<div
styleName='root'
@@ -179,20 +249,21 @@ class MarkdownSplitEditor extends React.Component {
>
<CodeEditor
ref='code'
width={this.state.codeEditorWidthInPercent + '%'}
width={editorStyle.width}
height={editorStyle.height}
mode='Boost Flavored Markdown'
value={value}
theme={config.editor.theme}
keyMap={config.editor.keyMap}
fontFamily={config.editor.fontFamily}
fontSize={editorFontSize}
fontSize={editorStyle.fontSize}
displayLineNumbers={config.editor.displayLineNumbers}
lineWrapping
matchingPairs={config.editor.matchingPairs}
matchingTriples={config.editor.matchingTriples}
explodingPairs={config.editor.explodingPairs}
indentType={config.editor.indentType}
indentSize={editorIndentSize}
indentSize={editorStyle.indentSize}
enableRulers={config.editor.enableRulers}
rulers={config.editor.rulers}
scrollPastEnd={config.editor.scrollPastEnd}
@@ -213,8 +284,8 @@ class MarkdownSplitEditor extends React.Component {
RTL={RTL}
/>
<div
styleName='slider'
style={{ left: this.state.codeEditorWidthInPercent + '%' }}
styleName={isStacking ? 'slider-hoz' : 'slider'}
style={{ left: sliderStyle.left, top: sliderStyle.top }}
onMouseDown={e => this.handleMouseDown(e)}
>
<div styleName='slider-hitbox' />

View File

@@ -3,6 +3,7 @@
height 100%
font-size 30px
display flex
flex-wrap wrap
.slider
absolute top bottom
top -2px
@@ -15,6 +16,14 @@
left -3px
z-index 10
cursor col-resize
.slider-hoz
absolute left right
.slider-hitbox
absolute left right
width: 100%
height 7px
cursor row-resize
apply-theme(theme)
body[data-theme={theme}]

View File

@@ -60,6 +60,7 @@ class MarkdownNoteDetail extends React.Component {
this.toggleLockButton = this.handleToggleLockButton.bind(this)
this.generateToc = this.handleGenerateToc.bind(this)
this.handleUpdateContent = this.handleUpdateContent.bind(this)
this.handleSwitchStackDirection = this.handleSwitchStackDirection.bind(this)
}
focus() {
@@ -67,6 +68,7 @@ class MarkdownNoteDetail extends React.Component {
}
componentDidMount() {
ee.on('editor:orientation', this.handleSwitchStackDirection)
ee.on('topbar:togglelockbutton', this.toggleLockButton)
ee.on('topbar:toggledirectionbutton', () => this.handleSwitchDirection())
ee.on('topbar:togglemodebutton', () => {
@@ -383,7 +385,7 @@ class MarkdownNoteDetail extends React.Component {
handleSwitchMode(type) {
// If in split mode, hide the lock button
this.setState(
{ editorType: type, isLockButtonShown: !(type === 'SPLIT') },
{ editorType: type, isLockButtonShown: type !== 'SPLIT' },
() => {
this.focus()
const newConfig = Object.assign({}, this.props.config)
@@ -393,6 +395,18 @@ class MarkdownNoteDetail extends React.Component {
)
}
handleSwitchStackDirection() {
this.setState(
prevState => ({ isStacking: !prevState.isStacking }),
() => {
this.focus()
const newConfig = Object.assign({}, this.props.config)
newConfig.ui.isStacking = this.state.isStacking
ConfigManager.set(newConfig)
}
)
}
handleSwitchDirection() {
if (!this.props.config.editor.rtlEnabled) {
return
@@ -429,7 +443,7 @@ class MarkdownNoteDetail extends React.Component {
renderEditor() {
const { config, ignorePreviewPointerEvents } = this.props
const { note } = this.state
const { note, isStacking } = this.state
if (this.state.editorType === 'EDITOR_PREVIEW') {
return (
@@ -455,6 +469,7 @@ class MarkdownNoteDetail extends React.Component {
value={note.content}
storageKey={note.storage}
noteKey={note.key}
isStacking={isStacking}
linesHighlighted={note.linesHighlighted}
onChange={this.handleUpdateContent}
ignorePreviewPointerEvents={ignorePreviewPointerEvents}

View File

@@ -20,6 +20,7 @@ class TagSelect extends React.Component {
}
this.handleAddTag = this.handleAddTag.bind(this)
this.handleRenameTag = this.handleRenameTag.bind(this)
this.onInputBlur = this.onInputBlur.bind(this)
this.onInputChange = this.onInputChange.bind(this)
this.onInputKeyDown = this.onInputKeyDown.bind(this)
@@ -88,6 +89,7 @@ class TagSelect extends React.Component {
this.buildSuggestions()
ee.on('editor:add-tag', this.handleAddTag)
ee.on('sidebar:rename-tag', this.handleRenameTag)
}
componentDidUpdate() {
@@ -96,12 +98,23 @@ class TagSelect extends React.Component {
componentWillUnmount() {
ee.off('editor:add-tag', this.handleAddTag)
ee.off('sidebar:rename-tag', this.handleRenameTag)
}
handleAddTag() {
this.refs.newTag.input.focus()
}
handleRenameTag(event, tagChange) {
const { value } = this.props
const { tag, updatedTag } = tagChange
const newTags = value.slice()
newTags[value.indexOf(tag)] = updatedTag
this.value = newTags
this.props.onChange()
}
handleTagLabelClick(tag) {
const { dispatch } = this.props

View File

@@ -6,6 +6,7 @@ import dataApi from 'browser/main/lib/dataApi'
import styles from './SideNav.styl'
import { openModal } from 'browser/main/lib/modal'
import PreferencesModal from '../modals/PreferencesModal'
import RenameTagModal from 'browser/main/modals/RenameTagModal'
import ConfigManager from 'browser/main/lib/ConfigManager'
import StorageItem from './StorageItem'
import TagListItem from 'browser/components/TagListItem'
@@ -170,6 +171,11 @@ class SideNav extends React.Component {
)
})
menu.push({
label: i18n.__('Rename Tag'),
click: this.handleRenameTagClick.bind(this, tag)
})
context.popup(menu)
}
@@ -193,6 +199,16 @@ class SideNav extends React.Component {
})
}
handleRenameTagClick(tagName) {
const { data, dispatch } = this.props
openModal(RenameTagModal, {
tagName,
data,
dispatch
})
}
handleColorPickerConfirm(color) {
const {
dispatch,

View File

@@ -71,7 +71,8 @@ export const DEFAULT_CONFIG = {
disableDirectWrite: false,
showScrollBar: true,
defaultNote: 'ALWAYS_ASK', // 'ALWAYS_ASK', 'SNIPPET_NOTE', 'MARKDOWN_NOTE'
showMenuBar: false
showMenuBar: false,
isStacking: false
},
editor: {
theme: 'base16-light',

View File

@@ -145,9 +145,7 @@ class InfoTab extends React.Component {
height='92'
/>
<div styleName='icon-right'>
<div styleName='appId'>
{i18n.__('Boostnote')} {appVersion}
</div>
<div styleName='appId'>Boostnote Legacy {appVersion}</div>
<div styleName='description'>
{i18n.__(
'An open source note-taking app made for programmers just like you.'

View File

@@ -1,7 +1,7 @@
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './RenameFolderModal.styl'
import styles from './RenameModal.styl'
import dataApi from 'browser/main/lib/dataApi'
import { store } from 'browser/main/store'
import ModalEscButton from 'browser/components/ModalEscButton'

View File

@@ -46,13 +46,18 @@
font-size 14px
colorPrimaryButton()
.error
text-align center
color #F44336
height 20px
apply-theme(theme)
body[data-theme={theme}]
.root
background-color transparent
.header
background-color get-theme-var(theme, 'button--hover-backgroundColor')
background-color transparent
border-color get-theme-var(theme, 'borderColor')
color get-theme-var(theme, 'text-color')

View File

@@ -0,0 +1,196 @@
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './RenameModal.styl'
import dataApi from 'browser/main/lib/dataApi'
import ModalEscButton from 'browser/components/ModalEscButton'
import i18n from 'browser/lib/i18n'
import { replace } from 'connected-react-router'
import ee from 'browser/main/lib/eventEmitter'
import { isEmpty } from 'lodash'
import electron from 'electron'
const { remote } = electron
const { dialog } = remote
class RenameTagModal extends React.Component {
constructor(props) {
super(props)
this.nameInput = null
this.handleChange = this.handleChange.bind(this)
this.setTextInputRef = el => {
this.nameInput = el
}
this.state = {
name: props.tagName,
oldName: props.tagName
}
}
componentDidMount() {
this.nameInput.focus()
this.nameInput.select()
}
handleChange(e) {
this.setState({
name: this.nameInput.value,
showerror: false,
errormessage: ''
})
}
handleKeyDown(e) {
if (e.keyCode === 27) {
this.props.close()
}
}
handleInputKeyDown(e) {
switch (e.keyCode) {
case 13:
this.handleConfirm()
}
}
handleConfirm() {
if (this.state.name.trim().length > 0) {
const { name, oldName } = this.state
this.renameTag(oldName, name)
}
}
showError(message) {
this.setState({
showerror: true,
errormessage: message
})
}
renameTag(tag, updatedTag) {
const { data, dispatch } = this.props
if (tag === updatedTag) {
// confirm with-out any change - just dismiss the modal
this.props.close()
return
}
if (
data.noteMap
.map(note => note)
.some(note => note.tags.indexOf(updatedTag) !== -1)
) {
const alertConfig = {
type: 'warning',
message: i18n.__('Confirm tag merge'),
detail: i18n.__(
`Tag ${tag} will be merged with existing tag ${updatedTag}`
),
buttons: [i18n.__('Confirm'), i18n.__('Cancel')]
}
const dialogButtonIndex = dialog.showMessageBox(
remote.getCurrentWindow(),
alertConfig
)
if (dialogButtonIndex === 1) {
return // bail early on cancel click
}
}
const notes = data.noteMap
.map(note => note)
.filter(
note => note.tags.indexOf(tag) !== -1 && note.tags.indexOf(updatedTag)
)
.map(note => {
note = Object.assign({}, note)
note.tags = note.tags.slice()
note.tags[note.tags.indexOf(tag)] = updatedTag
return note
})
if (isEmpty(notes)) {
this.showError(i18n.__('Tag exists'))
return
}
Promise.all(
notes.map(note => dataApi.updateNote(note.storage, note.key, note))
)
.then(updatedNotes => {
updatedNotes.forEach(note => {
dispatch({
type: 'UPDATE_NOTE',
note
})
})
})
.then(() => {
if (window.location.hash.includes(tag)) {
dispatch(replace(`/tags/${updatedTag}`))
}
ee.emit('sidebar:rename-tag', { tag, updatedTag })
this.props.close()
})
}
render() {
const { close } = this.props
const { errormessage } = this.state
return (
<div
styleName='root'
tabIndex='-1'
onKeyDown={e => this.handleKeyDown(e)}
>
<div styleName='header'>
<div styleName='title'>{i18n.__('Rename Tag')}</div>
</div>
<ModalEscButton handleEscButtonClick={close} />
<div styleName='control'>
<input
styleName='control-input'
placeholder={i18n.__('Tag Name')}
ref={this.setTextInputRef}
value={this.state.name}
onChange={this.handleChange}
onKeyDown={e => this.handleInputKeyDown(e)}
/>
<button
styleName='control-confirmButton'
onClick={() => this.handleConfirm()}
>
{i18n.__('Confirm')}
</button>
</div>
<div className='error' styleName='error'>
{errormessage}
</div>
</div>
)
}
}
RenameTagModal.propTypes = {
storage: PropTypes.shape({
key: PropTypes.string
}),
folder: PropTypes.shape({
key: PropTypes.string,
name: PropTypes.string
})
}
export default CSSModules(RenameTagModal, styles)

View File

@@ -314,6 +314,12 @@ const view = {
mainWindow.webContents.send('editor:fullscreen')
}
},
{
label: 'Toggle Editor Orientation',
click() {
mainWindow.webContents.send('editor:orientation')
}
},
{
type: 'separator'
},

View File

@@ -1,5 +1,11 @@
> [We've launched desktop and mobile app of the new Boost Note now.](https://github.com/BoostIO/BoostNote.next)
> ### [Boost Note for Teams](https://hub.boostio.co/)
>
> We'll launch the clean and simple wiki specially optimized for developers called "Boost Hub" at June 2020!
>
> Boost Hub will aim to be a collaborative wiki tool for teams to centralize and amplify the availability and search ability of both first-party and third-party information.
![Boostnote app screenshot](./resources/repository/top.png)
<h4 align="center">Note-taking app for programmers. </h4>
@@ -15,6 +21,10 @@
[Find the latest release of Boostnote here!](https://github.com/BoostIO/boost-releases/releases/)
## Roadmap
[Boost Note Roadmap 2020](https://medium.com/boostnote/boost-note-roadmap-2020-9f06a642f5f1)
## Authors & Maintainers
- [Rokt33r](https://github.com/rokt33r)
@@ -22,11 +32,13 @@
- [ZeroX-DG](https://github.com/ZeroX-DG)
## Contributors
Thank you to all the people who have contributed to Boostnote!
<a href="https://github.com/BoostIO/Boostnote/graphs/contributors"><img src="https://opencollective.com/boostnoteio/contributors.svg?width=890" /></a>
## Supporting Boostnote
Boostnote is an open source project. It's an independent project with its ongoing development made possible thanks to the support by our amazing backers.
Issues on Boostnote can be funded by anyone and the money will be distributed to contributors and maintainers. If you use Boostnote please consider becoming a backer:
@@ -34,18 +46,22 @@ Issues on Boostnote can be funded by anyone and the money will be distributed to
[![Let's fund issues in this repository](https://issuehunt.io/static/embed/issuehunt-button-v1.svg)](https://issuehunt.io/repos/53266139)
## Community
- [Facebook Group](https://www.facebook.com/groups/boostnote/)
- [Twitter](https://twitter.com/boostnoteapp)
- [Slack Group](https://join.slack.com/t/boostnote-group/shared_invite/enQtMzkxOTk4ODkyNzc0LWQxZTQwNjBlMDI4YjkyYjg2MTRiZGJhNzA1YjQ5ODA5M2M0M2NlMjI5YjhiYWQzNzgzYmU0MDMwOTlmZmZmMGE)
- [Slack Group](https://join.slack.com/t/boostnote-group/shared_invite/zt-cun7pas3-WwkaezxHBB1lCbUHrwQLXw)
- [Blog](https://medium.com/boostnote)
- [Reddit](https://www.reddit.com/r/Boostnote/)
### Boostnote mobile
A community project developing a mobile cross-platform version of boostnote for iOS and Android can be found here: [NoteApp](https://github.com/T0M0F/NoteApp)
#### More Information
* Website: https://boostnote.io
* [Development](https://github.com/BoostIO/Boostnote/blob/master/docs/build.md): Development configurations for Boostnote.
* Copyright (C) 2016 - 2020 BoostIO, Inc.
- Website: https://boostnote.io
- [Development](https://github.com/BoostIO/Boostnote/blob/master/docs/build.md): Development configurations for Boostnote.
- Copyright (C) 2016 - 2020 BoostIO, Inc.
#### License

View File

@@ -1,4 +1,3 @@
const test = require('ava')
const copyFile = require('browser/main/lib/dataApi/copyFile')
const path = require('path')
@@ -13,23 +12,25 @@ const srcPath = path.join(srcFolder, testFile)
const dstFolder = path.join(__dirname, '😇')
const dstPath = path.join(dstFolder, testFile)
test.before(t => {
beforeAll(() => {
if (!fs.existsSync(srcFolder)) fs.mkdirSync(srcFolder)
fs.writeFileSync(srcPath, 'test')
})
test('`copyFile` should handle encoded URI on src path', t => {
it('`copyFile` should handle encoded URI on src path', done => {
return copyFile(encodeURI(srcPath), dstPath)
.then(() => {
t.true(true)
expect(true).toBe(true)
done()
})
.catch(() => {
t.true(false)
expect(false).toBe(true)
done()
})
})
test.after(t => {
afterAll(() => {
fs.unlinkSync(srcPath)
fs.unlinkSync(dstPath)
execSync(removeDirCommand + '"' + srcFolder + '"')

View File

@@ -1,4 +1,3 @@
const test = require('ava')
const createFolder = require('browser/main/lib/dataApi/createFolder')
global.document = require('jsdom').jsdom('<body></body>')
@@ -19,32 +18,34 @@ const CSON = require('@rokt33r/season')
const storagePath = path.join(os.tmpdir(), 'test/create-folder')
test.beforeEach(t => {
t.context.storage = TestDummy.dummyStorage(storagePath)
localStorage.setItem('storages', JSON.stringify([t.context.storage.cache]))
let storageContext
beforeAll(() => {
storageContext = TestDummy.dummyStorage(storagePath)
localStorage.setItem('storages', JSON.stringify([storageContext.cache]))
})
test.serial('Create a folder', t => {
const storageKey = t.context.storage.cache.key
it('Create a folder', done => {
const storageKey = storageContext.cache.key
const input = {
name: 'created',
color: '#ff5555'
}
return Promise.resolve()
.then(function doTest() {
.then(() => {
return createFolder(storageKey, input)
})
.then(function assert(data) {
t.true(_.find(data.storage.folders, input) != null)
.then(data => {
expect(_.find(data.storage.folders, input)).not.toBeNull()
const jsonData = CSON.readFileSync(
path.join(data.storage.path, 'boostnote.json')
)
console.log(path.join(data.storage.path, 'boostnote.json'))
t.true(_.find(jsonData.folders, input) != null)
expect(_.find(jsonData.folders, input)).not.toBeNull()
done()
})
})
test.after(function after() {
afterAll(() => {
localStorage.clear()
sander.rimrafSync(storagePath)
})

View File

@@ -1,4 +1,3 @@
const test = require('ava')
const createNote = require('browser/main/lib/dataApi/createNote')
global.document = require('jsdom').jsdom('<body></body>')
@@ -19,14 +18,16 @@ const faker = require('faker')
const storagePath = path.join(os.tmpdir(), 'test/create-note')
test.beforeEach(t => {
t.context.storage = TestDummy.dummyStorage(storagePath)
localStorage.setItem('storages', JSON.stringify([t.context.storage.cache]))
let storageContext
beforeEach(() => {
storageContext = TestDummy.dummyStorage(storagePath)
localStorage.setItem('storages', JSON.stringify([storageContext.cache]))
})
test.serial('Create a note', t => {
const storageKey = t.context.storage.cache.key
const folderKey = t.context.storage.json.folders[0].key
it('Create a note', done => {
const storageKey = storageContext.cache.key
const folderKey = storageContext.json.folders[0].key
const randLinesHighlightedArray = new Array(10)
.fill()
@@ -58,58 +59,58 @@ test.serial('Create a note', t => {
input2.title = input2.content.split('\n').shift()
return Promise.resolve()
.then(function doTest() {
.then(() => {
return Promise.all([
createNote(storageKey, input1),
createNote(storageKey, input2)
])
})
.then(function assert(data) {
.then(data => {
const data1 = data[0]
const data2 = data[1]
t.is(storageKey, data1.storage)
expect(storageKey).toEqual(data1.storage)
const jsonData1 = CSON.readFileSync(
path.join(storagePath, 'notes', data1.key + '.cson')
)
t.is(input1.title, data1.title)
t.is(input1.title, jsonData1.title)
t.is(input1.description, data1.description)
t.is(input1.description, jsonData1.description)
t.is(input1.tags.length, data1.tags.length)
t.is(input1.tags.length, jsonData1.tags.length)
t.is(input1.snippets.length, data1.snippets.length)
t.is(input1.snippets.length, jsonData1.snippets.length)
t.is(input1.snippets[0].content, data1.snippets[0].content)
t.is(input1.snippets[0].content, jsonData1.snippets[0].content)
t.is(input1.snippets[0].name, data1.snippets[0].name)
t.is(input1.snippets[0].name, jsonData1.snippets[0].name)
t.deepEqual(
input1.snippets[0].linesHighlighted,
expect(input1.title).toEqual(data1.title)
expect(input1.title).toEqual(jsonData1.title)
expect(input1.description).toEqual(data1.description)
expect(input1.description).toEqual(jsonData1.description)
expect(input1.tags.length).toEqual(data1.tags.length)
expect(input1.tags.length).toEqual(jsonData1.tags.length)
expect(input1.snippets.length).toEqual(data1.snippets.length)
expect(input1.snippets.length).toEqual(jsonData1.snippets.length)
expect(input1.snippets[0].content).toEqual(data1.snippets[0].content)
expect(input1.snippets[0].content).toEqual(jsonData1.snippets[0].content)
expect(input1.snippets[0].name).toEqual(data1.snippets[0].name)
expect(input1.snippets[0].name).toEqual(jsonData1.snippets[0].name)
expect(input1.snippets[0].linesHighlighted).toEqual(
data1.snippets[0].linesHighlighted
)
t.deepEqual(
input1.snippets[0].linesHighlighted,
expect(input1.snippets[0].linesHighlighted).toEqual(
jsonData1.snippets[0].linesHighlighted
)
t.is(storageKey, data2.storage)
expect(storageKey).toEqual(data2.storage)
const jsonData2 = CSON.readFileSync(
path.join(storagePath, 'notes', data2.key + '.cson')
)
t.is(input2.title, data2.title)
t.is(input2.title, jsonData2.title)
t.is(input2.content, data2.content)
t.is(input2.content, jsonData2.content)
t.is(input2.tags.length, data2.tags.length)
t.is(input2.tags.length, jsonData2.tags.length)
t.deepEqual(input2.linesHighlighted, data2.linesHighlighted)
t.deepEqual(input2.linesHighlighted, jsonData2.linesHighlighted)
expect(input2.title).toEqual(data2.title)
expect(input2.title).toEqual(jsonData2.title)
expect(input2.content).toEqual(data2.content)
expect(input2.content).toEqual(jsonData2.content)
expect(input2.tags.length).toEqual(data2.tags.length)
expect(input2.tags.length).toEqual(jsonData2.tags.length)
expect(input2.linesHighlighted).toEqual(data2.linesHighlighted)
expect(input2.linesHighlighted).toEqual(jsonData2.linesHighlighted)
done()
})
})
test.after(function after() {
afterAll(function after() {
localStorage.clear()
sander.rimrafSync(storagePath)
})

View File

@@ -1,4 +1,3 @@
const test = require('ava')
const createNoteFromUrl = require('browser/main/lib/dataApi/createNoteFromUrl')
global.document = require('jsdom').jsdom('<body></body>')
@@ -18,32 +17,34 @@ const CSON = require('@rokt33r/season')
const storagePath = path.join(os.tmpdir(), 'test/create-note-from-url')
test.beforeEach(t => {
t.context.storage = TestDummy.dummyStorage(storagePath)
localStorage.setItem('storages', JSON.stringify([t.context.storage.cache]))
let storageContext
beforeEach(() => {
storageContext = TestDummy.dummyStorage(storagePath)
localStorage.setItem('storages', JSON.stringify([storageContext.cache]))
})
test.serial('Create a note from URL', t => {
const storageKey = t.context.storage.cache.key
const folderKey = t.context.storage.json.folders[0].key
it('Create a note from URL', () => {
const storageKey = storageContext.cache.key
const folderKey = storageContext.json.folders[0].key
const url = 'https://shapeshed.com/writing-cross-platform-node/'
return createNoteFromUrl(url, storageKey, folderKey).then(function assert({
note
}) {
t.is(storageKey, note.storage)
expect(storageKey).toEqual(note.storage)
const jsonData = CSON.readFileSync(
path.join(storagePath, 'notes', note.key + '.cson')
)
// Test if saved content is matching the created in memory note
t.is(note.content, jsonData.content)
t.is(note.tags.length, jsonData.tags.length)
expect(note.content).toEqual(jsonData.content)
expect(note.tags.length).toEqual(jsonData.tags.length)
})
})
test.after(function after() {
afterAll(function after() {
localStorage.clear()
sander.rimrafSync(storagePath)
})

View File

@@ -1,4 +1,3 @@
const test = require('ava')
const createSnippet = require('browser/main/lib/dataApi/createSnippet')
const sander = require('sander')
const os = require('os')
@@ -7,29 +6,27 @@ const path = require('path')
const snippetFilePath = path.join(os.tmpdir(), 'test', 'create-snippet')
const snippetFile = path.join(snippetFilePath, 'snippets.json')
test.beforeEach(t => {
beforeEach(() => {
sander.writeFileSync(snippetFile, '[]')
})
test.serial('Create a snippet', t => {
it('Create a snippet', () => {
return Promise.resolve()
.then(function doTest() {
return Promise.all([createSnippet(snippetFile)])
})
.then(() => Promise.all([createSnippet(snippetFile)]))
.then(function assert(data) {
data = data[0]
const snippets = JSON.parse(sander.readFileSync(snippetFile))
const snippet = snippets.find(
currentSnippet => currentSnippet.id === data.id
)
t.not(snippet, undefined)
t.is(snippet.name, data.name)
t.deepEqual(snippet.prefix, data.prefix)
t.is(snippet.content, data.content)
t.deepEqual(snippet.linesHighlighted, data.linesHighlighted)
expect(snippet).not.toBeUndefined()
expect(snippet.name).toEqual(data.name)
expect(snippet.prefix).toEqual(data.prefix)
expect(snippet.content).toEqual(data.content)
expect(snippet.linesHighlighted).toEqual(data.linesHighlighted)
})
})
test.after.always(() => {
afterAll(() => {
sander.rimrafSync(snippetFilePath)
})

View File

@@ -1,4 +1,3 @@
const test = require('ava')
const deleteFolder = require('browser/main/lib/dataApi/deleteFolder')
const attachmentManagement = require('browser/main/lib/dataApi/attachmentManagement')
const createNote = require('browser/main/lib/dataApi/createNote')
@@ -23,14 +22,16 @@ const CSON = require('@rokt33r/season')
const storagePath = path.join(os.tmpdir(), 'test/delete-folder')
test.beforeEach(t => {
t.context.storage = TestDummy.dummyStorage(storagePath)
localStorage.setItem('storages', JSON.stringify([t.context.storage.cache]))
let storageContext
beforeEach(() => {
storageContext = TestDummy.dummyStorage(storagePath)
localStorage.setItem('storages', JSON.stringify([storageContext.cache]))
})
test.serial('Delete a folder', t => {
const storageKey = t.context.storage.cache.key
const folderKey = t.context.storage.json.folders[0].key
it('Delete a folder', () => {
const storageKey = storageContext.cache.key
const folderKey = storageContext.json.folders[0].key
let noteKey
const input1 = {
@@ -72,16 +73,15 @@ test.serial('Delete a folder', t => {
return deleteFolder(storageKey, folderKey)
})
.then(function assert(data) {
t.true(_.find(data.storage.folders, { key: folderKey }) == null)
expect(_.find(data.storage.folders, { key: folderKey })).toBeUndefined()
const jsonData = CSON.readFileSync(
path.join(data.storage.path, 'boostnote.json')
)
t.true(_.find(jsonData.folders, { key: folderKey }) == null)
expect(_.find(jsonData.folders, { key: folderKey })).toBeUndefined()
const notePaths = sander.readdirSync(data.storage.path, 'notes')
t.is(
notePaths.length,
t.context.storage.notes.filter(note => note.folder !== folderKey).length
expect(notePaths.length).toBe(
storageContext.notes.filter(note => note.folder !== folderKey).length
)
const attachmentFolderPath = path.join(
@@ -89,11 +89,11 @@ test.serial('Delete a folder', t => {
attachmentManagement.DESTINATION_FOLDER,
noteKey
)
t.false(fs.existsSync(attachmentFolderPath))
expect(fs.existsSync(attachmentFolderPath)).toBe(false)
})
})
test.after.always(function after() {
afterAll(() => {
localStorage.clear()
sander.rimrafSync(storagePath)
})

View File

@@ -0,0 +1,189 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Markdown.render() should render PlantUML Ditaa correctly 1`] = `
"<img src=\\"http://www.plantuml.com/plantuml/png/SoWkIImgISaiIKpaqjQ50cq51GLj93Q2mrMZ00NQO3cmHX3RJW4cKmDI4v9QKQ805a8nfyObCp6zA34NgCObFxiqDpMl1AIcHj4tCJqpLH5i18evG52TKbk3B8og1kmC0cvMKB1Im0NYkA2ckMRcANWabgQbvYau5YMbPfP0p4UOWmcqkHnIyrB0GG00\\" alt=\\"uml diagram\\" />
"
`;
exports[`Markdown.render() should render PlantUML Gantt correctly 1`] = `
"<img src=\\"http://www.plantuml.com/plantuml/svg/SoWkIImgIK_CAodXYWueoY_9BwaiI5L8IItEJC-BLSX9B2ufLZ0qLKX9h2pcYWv9BIvHA82fWaiRu906crsia5YYW6cqUh52QbuAbmEG0DiE0000\\" alt=\\"uml diagram\\" />
"
`;
exports[`Markdown.render() should render PlantUML MindMaps correctly 1`] = `
"<img src=\\"http://www.plantuml.com/plantuml/svg/JOzD3e8m44Rtd6BMtNW192IM5I29HEDsAbKdeLD2MvNRIsjCMCsRlFd9LpgFipV4Wy4f4o2r8kHC23Yhm3wi9A0X3XzeYNrgwx1H6wvb1KTjqtRJoYhMtexBSAqJUescwoEUq4tn3xp9Fm7XfUS5HiiFO3Gw7SjT4QUCkkKxLy2-WAvl3rkrtEclBdOCXcnMwZN7ByiN\\" alt=\\"uml diagram\\" />
"
`;
exports[`Markdown.render() should render PlantUML Umls correctly 1`] = `
"<img src=\\"http://www.plantuml.com/plantuml/svg/LOzD2eCm44RtESMtj0jx01V5E_G4Gvngo2_912gbTsz4LBfylCV7p5Y4ibJlbEENG2AocHV1P39hCJ6eOar8bCaZaROqyrDMnzWqXTcn8YqnGzSYqNC-q76sweoW5zOsLi57uMpHz-WESslY0jmVw1AjdaE30IPeLoVUceLTslrL3-2tS9ZA_qZRtm_vgh7PzkOF\\" alt=\\"uml diagram\\" />
"
`;
exports[`Markdown.render() should render PlantUML WBS correctly 1`] = `
"<img src=\\"http://www.plantuml.com/plantuml/svg/ZP2_JiD03CRtFeNdRF04fR140gdGeREv-z8plVYYimFYxSabKbaxsR9-ylTdRyxLVpvjrz5XDb6OqR6MqEPRYSXPz4BdmsdNTVJAiuP4da1JBLy8lbmxUYxZbE6Wa_CLgUI8IXymS0rf9NeL5yxKDt24EhiKfMDcRNzVO79HcX8RLdvLfZBGa_KtFx2RKcpK7TZ3dTpZfWgskMAZ9jIXr94rW4PubM1RbBZOb-6NtcS9LpgBjlj_1w9QldbPjZHxQ5pg_GC0\\" alt=\\"uml diagram\\" />
"
`;
exports[`Markdown.render() should render footnote correctly 1`] = `
"<p data-line=\\"1\\"><sup class=\\"footnote-ref\\"><a href=\\"#fn1\\" id=\\"fnref1\\">[1]</a></sup><br />
hello-world: <a href=\\"https://github.com/BoostIO/Boostnote/\\">https://github.com/BoostIO/Boostnote/</a></p>
<hr class=\\"footnotes-sep\\" />
<section class=\\"footnotes\\">
<ol class=\\"footnotes-list\\">
<li id=\\"fn1\\" class=\\"footnote-item\\"><p>hello-world <a href=\\"#fnref1\\" class=\\"footnote-backref\\">↩︎</a></p>
</li>
</ol>
</section>
"
`;
exports[`Markdown.render() should render line breaks correctly 1`] = `
"<p data-line=\\"0\\">This is the first line.<br />
This is the second line.</p>
"
`;
exports[`Markdown.render() should render line breaks correctly 2`] = `
"<p data-line=\\"0\\">This is the first line.
This is the second line.</p>
"
`;
exports[`Markdown.render() should render shortcuts correctly 1`] = `
"<p data-line=\\"0\\"><kbd>Ctrl</kbd></p>
<p data-line=\\"2\\"><kbd>Ctrl</kbd></p>
"
`;
exports[`Markdown.render() should renders [TOC] placholder correctly 1`] = `
"<p data-line=\\"1\\"><div class=\\"markdownIt-TOC-wrapper\\"><ul class=\\"markdownIt-TOC\\">
<li><a href=\\"#H1\\">H1</a>
<ul>
<li><a href=\\"#H2\\">H2</a>
<ul>
<li><a href=\\"#H3\\">H3</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div></p>
<h1 id=\\"H1\\" data-line=\\"2\\">H1</h1>
<h2 id=\\"H2\\" data-line=\\"3\\">H2</h2>
<h3 id=\\"H3\\" data-line=\\"4\\">H3</h3>
<p data-line=\\"5\\">###$ H4</p>
"
`;
exports[`Markdown.render() should renders KaTeX correctly 1`] = `
"<span class=\\"katex-display\\"><span class=\\"katex\\"><span class=\\"katex-mathml\\"><math><semantics><mrow><mi>c</mi><mo>=</mo><mi>p</mi><mi>m</mi><mi>s</mi><mi>q</mi><mi>r</mi><mi>t</mi><mrow><msup><mi>a</mi><mn>2</mn></msup><mo>+</mo><msup><mi>b</mi><mn>2</mn></msup></mrow></mrow><annotation encoding=\\"application/x-tex\\">c = pmsqrt{a^2 + b^2}</annotation></semantics></math></span><span class=\\"katex-html\\" aria-hidden=\\"true\\"><span class=\\"base\\"><span class=\\"strut\\" style=\\"height:0.43056em;vertical-align:0em;\\"></span><span class=\\"mord mathdefault\\">c</span><span class=\\"mspace\\" style=\\"margin-right:0.2777777777777778em;\\"></span><span class=\\"mrel\\">=</span><span class=\\"mspace\\" style=\\"margin-right:0.2777777777777778em;\\"></span></span><span class=\\"base\\"><span class=\\"strut\\" style=\\"height:1.0585479999999998em;vertical-align:-0.19444em;\\"></span><span class=\\"mord mathdefault\\">p</span><span class=\\"mord mathdefault\\">m</span><span class=\\"mord mathdefault\\">s</span><span class=\\"mord mathdefault\\" style=\\"margin-right:0.03588em;\\">q</span><span class=\\"mord mathdefault\\" style=\\"margin-right:0.02778em;\\">r</span><span class=\\"mord mathdefault\\">t</span><span class=\\"mord\\"><span class=\\"mord\\"><span class=\\"mord mathdefault\\">a</span><span class=\\"msupsub\\"><span class=\\"vlist-t\\"><span class=\\"vlist-r\\"><span class=\\"vlist\\" style=\\"height:0.8641079999999999em;\\"><span style=\\"top:-3.113em;margin-right:0.05em;\\"><span class=\\"pstrut\\" style=\\"height:2.7em;\\"></span><span class=\\"sizing reset-size6 size3 mtight\\"><span class=\\"mord mtight\\">2</span></span></span></span></span></span></span></span><span class=\\"mspace\\" style=\\"margin-right:0.2222222222222222em;\\"></span><span class=\\"mbin\\">+</span><span class=\\"mspace\\" style=\\"margin-right:0.2222222222222222em;\\"></span><span class=\\"mord\\"><span class=\\"mord mathdefault\\">b</span><span class=\\"msupsub\\"><span class=\\"vlist-t\\"><span class=\\"vlist-r\\"><span class=\\"vlist\\" style=\\"height:0.8641079999999999em;\\"><span style=\\"top:-3.113em;margin-right:0.05em;\\"><span class=\\"pstrut\\" style=\\"height:2.7em;\\"></span><span class=\\"sizing reset-size6 size3 mtight\\"><span class=\\"mord mtight\\">2</span></span></span></span></span></span></span></span></span></span></span></span></span>
"
`;
exports[`Markdown.render() should renders abbrevations correctly 1`] = `
"<h2 id=\\"abbr\\" data-line=\\"1\\">abbr</h2>
<p data-line=\\"3\\">The <abbr title=\\"Hyper Text Markup Language\\">HTML</abbr> specification<br />
is maintained by the <abbr title=\\"World Wide Web Consortium\\">W3C</abbr>.</p>
"
`;
exports[`Markdown.render() should renders checkboxes 1`] = `
"<ul>
<li class=\\"taskListItem\\" data-line=\\"1\\"><input type=\\"checkbox\\" id=\\"checkbox-2\\" /> Unchecked</li>
<li class=\\"taskListItem checked\\" data-line=\\"2\\"><input type=\\"checkbox\\" checked id=\\"checkbox-3\\" /> Checked</li>
</ul>
"
`;
exports[`Markdown.render() should renders codeblock correctly 1`] = `
"<pre class=\\"code CodeMirror\\" data-line=\\"1\\">
<span class=\\"filename\\">filename.js</span>
<span class=\\"lineNumber CodeMirror-gutters\\"><span class=\\"CodeMirror-linenumber\\">2</span></span>
<code class=\\"js\\">var project = 'boostnote';
</code>
</pre>"
`;
exports[`Markdown.render() should renders definition lists correctly 1`] = `
"<h2 id=\\"definition-list\\" data-line=\\"1\\">definition list</h2>
<h3 id=\\"list-1\\" data-line=\\"3\\">list 1</h3>
<dl>
<dt data-line=\\"5\\">Term 1</dt>
<dd data-line=\\"6\\">Definition 1</dd>
<dt data-line=\\"8\\">Term 2</dt>
<dd data-line=\\"9\\">Definition 2a</dd>
<dd data-line=\\"10\\">Definition 2b</dd>
</dl>
<p data-line=\\"12\\">Term 3<br />
~</p>
<h3 id=\\"list-2\\" data-line=\\"16\\">list 2</h3>
<dl>
<dt data-line=\\"18\\">Term 1</dt>
<dd data-line=\\"20\\">
<p data-line=\\"20\\">Definition 1</p>
</dd>
<dt data-line=\\"22\\">Term 2 with <em>inline markup</em></dt>
<dd data-line=\\"24\\">
<p data-line=\\"24\\">Definition 2</p>
<pre><code> { some code, part of Definition 2 }
</code></pre>
<p data-line=\\"28\\">Third paragraph of definition 2.</p>
</dd>
</dl>
"
`;
exports[`Markdown.render() should renders markdown correctly 1`] = `
"<h1 id=\\"Welcome-to-Boostnote\\" data-line=\\"1\\">Welcome to Boostnote!</h1>
<h2 id=\\"Click-here-to-edit-markdown\\" data-line=\\"2\\">Click here to edit markdown 👋</h2>
<iframe width=\\"560\\" height=\\"315\\" src=\\"https://www.youtube.com/embed/L0qNPLsvmyM\\" frameborder=\\"0\\" allowfullscreen></iframe>
<h2 id=\\"Docs\\" data-line=\\"6\\">Docs 📝</h2>
<ul>
<li data-line=\\"7\\"><a href=\\"https://hackernoon.com/boostnote-boost-your-happiness-productivity-and-creativity-315034efeebe\\">Boostnote | Boost your happiness, productivity and creativity.</a></li>
<li data-line=\\"8\\"><a href=\\"https://github.com/BoostIO/Boostnote/wiki/Cloud-Syncing-and-Backup\\">Cloud Syncing &amp; Backups</a></li>
<li data-line=\\"9\\"><a href=\\"https://github.com/BoostIO/Boostnote/wiki/Sync-Data-Across-Desktop-and-Mobile-apps\\">How to sync your data across Desktop and Mobile apps</a></li>
<li data-line=\\"10\\"><a href=\\"https://github.com/BoostIO/Boostnote/wiki/Evernote\\">Convert data from <strong>Evernote</strong> to Boostnote.</a></li>
<li data-line=\\"11\\"><a href=\\"https://github.com/BoostIO/Boostnote/wiki/Keyboard-Shortcuts\\">Keyboard Shortcuts</a></li>
<li data-line=\\"12\\"><a href=\\"https://github.com/BoostIO/Boostnote/wiki/Keymaps-in-Editor-mode\\">Keymaps in Editor mode</a></li>
<li data-line=\\"13\\"><a href=\\"https://github.com/BoostIO/Boostnote/wiki/Syntax-Highlighting\\">How to set syntax highlight in Snippet note</a></li>
</ul>
<hr />
<h2 id=\\"Article-Archive\\" data-line=\\"17\\">Article Archive 📚</h2>
<ul>
<li data-line=\\"18\\"><a href=\\"http://bit.ly/2mOJPu7\\">Reddit English</a></li>
<li data-line=\\"19\\"><a href=\\"https://www.reddit.com/r/boostnote_es/\\">Reddit Spanish</a></li>
<li data-line=\\"20\\"><a href=\\"https://www.reddit.com/r/boostnote_cn/\\">Reddit Chinese</a></li>
<li data-line=\\"21\\"><a href=\\"https://www.reddit.com/r/boostnote_jp/\\">Reddit Japanese</a></li>
</ul>
<hr />
<h2 id=\\"Community\\" data-line=\\"25\\">Community 🍻</h2>
<ul>
<li data-line=\\"26\\"><a href=\\"http://bit.ly/2AWWzkD\\">GitHub</a></li>
<li data-line=\\"27\\"><a href=\\"http://bit.ly/2z8BUJZ\\">Twitter</a></li>
<li data-line=\\"28\\"><a href=\\"http://bit.ly/2jcca8t\\">Facebook Group</a></li>
</ul>
"
`;
exports[`Markdown.render() should renders sub correctly 1`] = `
"<h2 id=\\"sub\\" data-line=\\"1\\">sub</h2>
<p data-line=\\"3\\">H<sub>2</sub>0</p>
"
`;
exports[`Markdown.render() should renders sup correctly 1`] = `
"<h2 id=\\"sup\\" data-line=\\"1\\">sup</h2>
<p data-line=\\"3\\">29<sup>th</sup></p>
"
`;
exports[`Markdown.render() should text with quotes correctly 1`] = `
"<p data-line=\\"0\\">This is a “QUOTE”.</p>
"
`;
exports[`Markdown.render() should text with quotes correctly 2`] = `
"<p data-line=\\"0\\">This is a &quot;QUOTE&quot;.</p>
"
`;

View File

@@ -1,46 +1,45 @@
const { escapeHtmlCharacters } = require('browser/lib/utils')
const test = require('ava')
test('escapeHtmlCharacters should return the original string if nothing needed to escape', t => {
test('escapeHtmlCharacters should return the original string if nothing needed to escape', () => {
const input = 'Nothing to be escaped'
const expected = 'Nothing to be escaped'
const actual = escapeHtmlCharacters(input)
t.is(actual, expected)
expect(actual).toBe(expected)
})
test('escapeHtmlCharacters should skip code block if that option is enabled', t => {
test('escapeHtmlCharacters should skip code block if that option is enabled', () => {
const input = ` <no escape>
<escapeMe>`
const expected = ` <no escape>
&lt;escapeMe&gt;`
const actual = escapeHtmlCharacters(input, { detectCodeBlock: true })
t.is(actual, expected)
expect(actual).toBe(expected)
})
test('escapeHtmlCharacters should NOT skip character not in code block but start with 4 spaces', t => {
test('escapeHtmlCharacters should NOT skip character not in code block but start with 4 spaces', () => {
const input = '4 spaces &'
const expected = '4 spaces &amp;'
const actual = escapeHtmlCharacters(input, { detectCodeBlock: true })
t.is(actual, expected)
expect(actual).toBe(expected)
})
test('escapeHtmlCharacters should NOT skip code block if that option is NOT enabled', t => {
test('escapeHtmlCharacters should NOT skip code block if that option is NOT enabled', () => {
const input = ` <no escape>
<escapeMe>`
const expected = ` &lt;no escape&gt;
&lt;escapeMe&gt;`
const actual = escapeHtmlCharacters(input)
t.is(actual, expected)
expect(actual).toBe(expected)
})
test("escapeHtmlCharacters should NOT escape & character if it's a part of an escaped character", t => {
test("escapeHtmlCharacters should NOT escape & character if it's a part of an escaped character", () => {
const input = 'Do not escape &amp; or &quot; but do escape &'
const expected = 'Do not escape &amp; or &quot; but do escape &amp;'
const actual = escapeHtmlCharacters(input)
t.is(actual, expected)
expect(actual).toBe(expected)
})
test('escapeHtmlCharacters should skip char if in code block', t => {
test('escapeHtmlCharacters should skip char if in code block', () => {
const input = `
\`\`\`
<dontescapeme>
@@ -62,12 +61,12 @@ dasdasdasd
\`\`\`
`
const actual = escapeHtmlCharacters(input, { detectCodeBlock: true })
t.is(actual, expected)
expect(actual).toBe(expected)
})
test('escapeHtmlCharacters should return the correct result', t => {
test('escapeHtmlCharacters should return the correct result', () => {
const input = '& < > " \''
const expected = '&amp; &lt; &gt; &quot; &#39;'
const actual = escapeHtmlCharacters(input)
t.is(actual, expected)
expect(actual).toBe(expected)
})

View File

@@ -1,4 +1,3 @@
const test = require('ava')
const { findStorage } = require('browser/lib/findStorage')
global.document = require('jsdom').jsdom('<body></body>')
@@ -16,20 +15,22 @@ const sander = require('sander')
const os = require('os')
const storagePath = path.join(os.tmpdir(), 'test/find-storage')
test.beforeEach(t => {
t.context.storage = TestDummy.dummyStorage(storagePath)
localStorage.setItem('storages', JSON.stringify([t.context.storage.cache]))
let storageContext
beforeEach(() => {
storageContext = TestDummy.dummyStorage(storagePath)
localStorage.setItem('storages', JSON.stringify([storageContext.cache]))
})
// Unit test
test('findStorage() should return a correct storage path(string)', t => {
const storageKey = t.context.storage.cache.key
test('findStorage() should return a correct storage path(string)', () => {
const storageKey = storageContext.cache.key
t.is(findStorage(storageKey).key, storageKey)
t.is(findStorage(storageKey).path, storagePath)
expect(findStorage(storageKey).key).toBe(storageKey)
expect(findStorage(storageKey).path).toBe(storagePath)
})
test.after(function after() {
afterAll(function after() {
localStorage.clear()
sander.rimrafSync(storagePath)
})

View File

@@ -2,11 +2,10 @@
* @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 => {
test('findNoteTitle#find should return a correct title (string)', () => {
// [input, expected]
const testCases = [
['# hoge\nfuga', '# hoge'],
@@ -20,15 +19,11 @@ test('findNoteTitle#find should return a correct title (string)', t => {
testCases.forEach(testCase => {
const [input, expected] = testCase
t.is(
findNoteTitle(input, false),
expected,
`Test for find() input: ${input} expected: ${expected}`
)
expect(findNoteTitle(input, false)).toBe(expected)
})
})
test('findNoteTitle#find should ignore front matter when enableFrontMatterTitle=false', t => {
test('findNoteTitle#find should ignore front matter when enableFrontMatterTitle=false', () => {
// [input, expected]
const testCases = [
['---\nlayout: test\ntitle: hoge hoge hoge \n---\n# fuga', '# fuga'],
@@ -38,15 +33,11 @@ test('findNoteTitle#find should ignore front matter when enableFrontMatterTitle
testCases.forEach(testCase => {
const [input, expected] = testCase
t.is(
findNoteTitle(input, false),
expected,
`Test for find() input: ${input} expected: ${expected}`
)
expect(findNoteTitle(input, false)).toBe(expected)
})
})
test('findNoteTitle#find should respect front matter when enableFrontMatterTitle=true', t => {
test('findNoteTitle#find should respect front matter when enableFrontMatterTitle=true', () => {
// [input, expected]
const testCases = [
[
@@ -59,15 +50,11 @@ test('findNoteTitle#find should respect front matter when enableFrontMatterTitl
testCases.forEach(testCase => {
const [input, expected] = testCase
t.is(
findNoteTitle(input, true),
expected,
`Test for find() input: ${input} expected: ${expected}`
)
expect(findNoteTitle(input, true)).toBe(expected)
})
})
test('findNoteTitle#find should respect frontMatterTitleField when provided', t => {
test('findNoteTitle#find should respect frontMatterTitleField when provided', () => {
// [input, expected]
const testCases = [
['---\ntitle: hoge\n---\n# fuga', '# fuga'],
@@ -76,10 +63,6 @@ test('findNoteTitle#find should respect frontMatterTitleField when provided', t
testCases.forEach(testCase => {
const [input, expected] = testCase
t.is(
findNoteTitle(input, true, 'custom'),
expected,
`Test for find() input: ${input} expected: ${expected}`
)
expect(findNoteTitle(input, true, 'custom')).toBe(expected)
})
})

View File

@@ -1,8 +1,7 @@
const test = require('ava')
const { getTodoStatus } = require('browser/lib/getTodoStatus')
// Unit test
test('getTodoStatus should return a correct hash object', t => {
test('getTodoStatus should return a correct hash object', () => {
// [input, expected]
const testCases = [
['', { total: 0, completed: 0 }],
@@ -40,15 +39,7 @@ test('getTodoStatus should return a correct hash object', t => {
testCases.forEach(testCase => {
const [input, expected] = testCase
t.is(
getTodoStatus(input).total,
expected.total,
`Test for getTodoStatus() input: ${input} expected: ${expected.total}`
)
t.is(
getTodoStatus(input).completed,
expected.completed,
`Test for getTodoStatus() input: ${input} expected: ${expected.completed}`
)
expect(getTodoStatus(input).total).toBe(expected.total)
expect(getTodoStatus(input).completed).toBe(expected.completed)
})
})

View File

@@ -1,11 +1,10 @@
/**
* @fileoverview Unit test for browser/lib/htmlTextHelper
*/
const test = require('ava')
const htmlTextHelper = require('browser/lib/htmlTextHelper')
// Unit test
test('htmlTextHelper#decodeEntities should return encoded text (string)', t => {
test('htmlTextHelper#decodeEntities should return encoded text (string)', () => {
// [input, expected]
const testCases = [
['&lt;a href=', '<a href='],
@@ -21,15 +20,11 @@ test('htmlTextHelper#decodeEntities should return encoded text (string)', t => {
testCases.forEach(testCase => {
const [input, expected] = testCase
t.is(
htmlTextHelper.decodeEntities(input),
expected,
`Test for decodeEntities() input: ${input} expected: ${expected}`
)
expect(htmlTextHelper.decodeEntities(input)).toBe(expected)
})
})
test('htmlTextHelper#decodeEntities() should return decoded text (string)', t => {
test('htmlTextHelper#decodeEntities() should return decoded text (string)', () => {
// [input, expected]
const testCases = [
['<a href=', '&lt;a href='],
@@ -44,16 +39,12 @@ test('htmlTextHelper#decodeEntities() should return decoded text (string)', t =>
testCases.forEach(testCase => {
const [input, expected] = testCase
t.is(
htmlTextHelper.encodeEntities(input),
expected,
`Test for encodeEntities() input: ${input} expected: ${expected}`
)
expect(htmlTextHelper.encodeEntities(input)).toBe(expected)
})
})
// Integration test
test(t => {
test(() => {
const testCases = [
"var test = 'test'",
"<a href='https://boostnote.io'>Boostnote",
@@ -63,10 +54,6 @@ test(t => {
testCases.forEach(testCase => {
const encodedText = htmlTextHelper.encodeEntities(testCase)
const decodedText = htmlTextHelper.decodeEntities(encodedText)
t.is(
decodedText,
testCase,
'Integration test through encodedText() and decodedText()'
)
expect(decodedText).toBe(testCase)
})
})

View File

@@ -1,10 +1,9 @@
/**
* @fileoverview Unit test for browser/lib/markdown
*/
const test = require('ava')
const markdown = require('browser/lib/markdownTextHelper')
test(t => {
test(() => {
// [input, expected]
const testCases = [
// List
@@ -42,10 +41,6 @@ test(t => {
testCases.forEach(testCase => {
const [input, expected] = testCase
t.is(
markdown.strip(input),
expected,
`Test for strip() input: ${input} expected: ${expected}`
)
expect(markdown.strip(input)).toBe(expected)
})
})

View File

@@ -4,11 +4,10 @@
import CodeMirror from 'codemirror'
require('codemirror/addon/search/searchcursor.js')
const test = require('ava')
const markdownToc = require('browser/lib/markdown-toc-generator')
const EOL = require('os').EOL
test(t => {
test(() => {
/**
* Contains array of test cases in format :
* [
@@ -261,15 +260,11 @@ this is a text
const expectedToc = testCase[2].trim()
const generatedToc = markdownToc.generate(inputMd)
t.is(
generatedToc,
expectedToc,
`generate test : ${title} , generated : ${EOL}${generatedToc}, expected : ${EOL}${expectedToc}`
)
expect(generatedToc).toBe(expectedToc)
})
})
test(t => {
test(() => {
/**
* Contains array of test cases in format :
* [
@@ -667,10 +662,6 @@ this is a level one text
editor.setCursor(cursor)
markdownToc.generateInEditor(editor)
t.is(
expectedMd,
editor.getValue(),
`generateInEditor test : ${title} , generated : ${EOL}${editor.getValue()}, expected : ${EOL}${expectedMd}`
)
expect(expectedMd).toBe(editor.getValue())
})
})

View File

@@ -1,4 +1,17 @@
import test from 'ava'
jest.mock(
'electron',
() => {
return {
remote: {
app: {
getPath: jest.fn().mockReturnValue('.')
}
}
}
},
{ virtual: true }
)
import Markdown from 'browser/lib/markdown'
import markdownFixtures from '../fixtures/markdowns'
@@ -6,100 +19,100 @@ import markdownFixtures from '../fixtures/markdowns'
// To test markdown options, initialize a new instance in your test case
const md = new Markdown()
test('Markdown.render() should renders markdown correctly', t => {
test('Markdown.render() should renders markdown correctly', () => {
const rendered = md.render(markdownFixtures.basic)
t.snapshot(rendered)
expect(rendered).toMatchSnapshot()
})
test('Markdown.render() should renders codeblock correctly', t => {
test('Markdown.render() should renders codeblock correctly', () => {
const rendered = md.render(markdownFixtures.codeblock)
t.snapshot(rendered)
expect(rendered).toMatchSnapshot()
})
test('Markdown.render() should renders KaTeX correctly', t => {
test('Markdown.render() should renders KaTeX correctly', () => {
const rendered = md.render(markdownFixtures.katex)
t.snapshot(rendered)
expect(rendered).toMatchSnapshot()
})
test('Markdown.render() should renders checkboxes', t => {
test('Markdown.render() should renders checkboxes', () => {
const rendered = md.render(markdownFixtures.checkboxes)
t.snapshot(rendered)
expect(rendered).toMatchSnapshot()
})
test('Markdown.render() should text with quotes correctly', t => {
test('Markdown.render() should text with quotes correctly', () => {
const renderedSmartQuotes = md.render(markdownFixtures.smartQuotes)
t.snapshot(renderedSmartQuotes)
expect(renderedSmartQuotes).toMatchSnapshot()
const newmd = new Markdown({ typographer: false })
const renderedNonSmartQuotes = newmd.render(markdownFixtures.smartQuotes)
t.snapshot(renderedNonSmartQuotes)
expect(renderedNonSmartQuotes).toMatchSnapshot()
})
test('Markdown.render() should render line breaks correctly', t => {
test('Markdown.render() should render line breaks correctly', () => {
const renderedBreaks = md.render(markdownFixtures.breaks)
t.snapshot(renderedBreaks)
expect(renderedBreaks).toMatchSnapshot()
const newmd = new Markdown({ breaks: false })
const renderedNonBreaks = newmd.render(markdownFixtures.breaks)
t.snapshot(renderedNonBreaks)
expect(renderedNonBreaks).toMatchSnapshot()
})
test('Markdown.render() should renders abbrevations correctly', t => {
test('Markdown.render() should renders abbrevations correctly', () => {
const rendered = md.render(markdownFixtures.abbrevations)
t.snapshot(rendered)
expect(rendered).toMatchSnapshot()
})
test('Markdown.render() should renders sub correctly', t => {
test('Markdown.render() should renders sub correctly', () => {
const rendered = md.render(markdownFixtures.subTexts)
t.snapshot(rendered)
expect(rendered).toMatchSnapshot()
})
test('Markdown.render() should renders sup correctly', t => {
test('Markdown.render() should renders sup correctly', () => {
const rendered = md.render(markdownFixtures.supTexts)
t.snapshot(rendered)
expect(rendered).toMatchSnapshot()
})
test('Markdown.render() should renders definition lists correctly', t => {
test('Markdown.render() should renders definition lists correctly', () => {
const rendered = md.render(markdownFixtures.deflists)
t.snapshot(rendered)
expect(rendered).toMatchSnapshot()
})
test('Markdown.render() should render shortcuts correctly', t => {
test('Markdown.render() should render shortcuts correctly', () => {
const rendered = md.render(markdownFixtures.shortcuts)
t.snapshot(rendered)
expect(rendered).toMatchSnapshot()
})
test('Markdown.render() should render footnote correctly', t => {
test('Markdown.render() should render footnote correctly', () => {
const rendered = md.render(markdownFixtures.footnote)
t.snapshot(rendered)
expect(rendered).toMatchSnapshot()
})
test('Markdown.render() should renders [TOC] placholder correctly', t => {
test('Markdown.render() should renders [TOC] placholder correctly', () => {
const rendered = md.render(markdownFixtures.tocPlaceholder)
t.snapshot(rendered)
expect(rendered).toMatchSnapshot()
})
test('Markdown.render() should render PlantUML MindMaps correctly', t => {
test('Markdown.render() should render PlantUML MindMaps correctly', () => {
const rendered = md.render(markdownFixtures.plantUmlMindMap)
t.snapshot(rendered)
expect(rendered).toMatchSnapshot()
})
test('Markdown.render() should render PlantUML Gantt correctly', t => {
test('Markdown.render() should render PlantUML Gantt correctly', () => {
const rendered = md.render(markdownFixtures.plantUmlGantt)
t.snapshot(rendered)
expect(rendered).toMatchSnapshot()
})
test('Markdown.render() should render PlantUML WBS correctly', t => {
test('Markdown.render() should render PlantUML WBS correctly', () => {
const rendered = md.render(markdownFixtures.plantUmlWbs)
t.snapshot(rendered)
expect(rendered).toMatchSnapshot()
})
test('Markdown.render() should render PlantUML Umls correctly', t => {
test('Markdown.render() should render PlantUML Umls correctly', () => {
const rendered = md.render(markdownFixtures.plantUmlUml)
t.snapshot(rendered)
expect(rendered).toMatchSnapshot()
})
test('Markdown.render() should render PlantUML Ditaa correctly', t => {
test('Markdown.render() should render PlantUML Ditaa correctly', () => {
const rendered = md.render(markdownFixtures.plantUmlDitaa)
t.snapshot(rendered)
expect(rendered).toMatchSnapshot()
})

View File

@@ -1,19 +1,17 @@
/**
* @fileoverview Unit test for browser/lib/normalizeEditorFontFamily
*/
import test from 'ava'
import normalizeEditorFontFamily from '../../browser/lib/normalizeEditorFontFamily'
import consts from '../../browser/lib/consts'
const defaultEditorFontFamily = consts.DEFAULT_EDITOR_FONT_FAMILY
test('normalizeEditorFontFamily() should return default font family (string[])', t => {
t.is(normalizeEditorFontFamily(), defaultEditorFontFamily.join(', '))
test('normalizeEditorFontFamily() should return default font family (string[])', () => {
expect(normalizeEditorFontFamily()).toBe(defaultEditorFontFamily.join(', '))
})
test('normalizeEditorFontFamily(["hoge", "huga"]) should return default font family connected with arg.', t => {
test('normalizeEditorFontFamily(["hoge", "huga"]) should return default font family connected with arg.', () => {
const arg = 'font1, font2'
t.is(
normalizeEditorFontFamily(arg),
expect(normalizeEditorFontFamily(arg)).toBe(
`${arg}, ${defaultEditorFontFamily.join(', ')}`
)
})

View File

@@ -1,9 +1,8 @@
const test = require('ava')
const path = require('path')
const { parse } = require('browser/lib/RcParser')
// Unit test
test('RcParser should return a json object', t => {
test('RcParser should return a json object', () => {
const validJson = {
editor: { keyMap: 'vim', switchPreview: 'BLUR', theme: 'monokai' },
hotkey: { toggleMain: 'Control + L' },
@@ -51,20 +50,12 @@ test('RcParser should return a json object', t => {
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}`
)
expect(parse(filePath(input)).editor.keyMap).toBe(expected.editor.keyMap)
})
invalidTestCases.forEach(invalidTestCase => {
const [input, expected] = invalidTestCase
t.is(
parse(filePath(input)).editor,
expected.editor,
`Test for getTodoStatus() input: ${input} expected: ${expected.editor}`
)
expect(parse(filePath(input)).editor).toBe(expected.editor)
})
})

View File

@@ -1,4 +1,3 @@
import test from 'ava'
import searchFromNotes from 'browser/lib/search'
import { dummyNote } from '../fixtures/TestDummy'
import _ from 'lodash'
@@ -11,7 +10,7 @@ const pickContents = notes =>
let notes = []
let note1, note2, note3
test.before(t => {
beforeAll(() => {
const data1 = { type: 'MARKDOWN_NOTE', content: 'content1', tags: ['tag1'] }
const data2 = {
type: 'MARKDOWN_NOTE',
@@ -27,7 +26,7 @@ test.before(t => {
notes = [note1, note2, note3]
})
test('it can find notes by tags and words', t => {
test('it can find notes by tags and words', () => {
// [input, expected content (Array)]
const testWithTags = [
['#tag1', [note1.content, note2.content, note3.content]],
@@ -49,6 +48,8 @@ test('it can find notes by tags and words', t => {
testCases.forEach(testCase => {
const [input, expectedContents] = testCase
const results = searchFromNotes(notes, input)
t.true(_.isEqual(pickContents(results).sort(), expectedContents.sort()))
expect(
_.isEqual(pickContents(results).sort(), expectedContents.sort())
).toBe(true)
})
})

View File

@@ -1,58 +1,57 @@
import test from 'ava'
import slugify from 'browser/lib/slugify'
test('alphabet and digit', t => {
test('alphabet and digit', () => {
const upperAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
const lowerAlphabet = 'abcdefghijklmnopqrstuvwxyz'
const digit = '0123456789'
const testCase = upperAlphabet + lowerAlphabet + digit
const decodeSlug = decodeURI(slugify(testCase))
t.true(decodeSlug === testCase)
expect(decodeSlug === testCase).toBe(true)
})
test('should delete unavailable symbols', t => {
test('should delete unavailable symbols', () => {
const availableSymbols = '_-'
const testCase = availableSymbols + "][!'#$%&()*+,./:;<=>?@\\^{|}~`"
const decodeSlug = decodeURI(slugify(testCase))
t.true(decodeSlug === availableSymbols)
expect(decodeSlug === availableSymbols).toBe(true)
})
test('should convert from white spaces between words to hyphens', t => {
test('should convert from white spaces between words to hyphens', () => {
const testCase = 'This is one'
const expectedString = 'This-is-one'
const decodeSlug = decodeURI(slugify(testCase))
t.true(decodeSlug === expectedString)
expect(decodeSlug === expectedString).toBe(true)
})
test('should remove leading white spaces', t => {
test('should remove leading white spaces', () => {
const testCase = ' This is one'
const expectedString = 'This-is-one'
const decodeSlug = decodeURI(slugify(testCase))
t.true(decodeSlug === expectedString)
expect(decodeSlug === expectedString).toBe(true)
})
test('should remove trailing white spaces', t => {
test('should remove trailing white spaces', () => {
const testCase = 'This is one '
const expectedString = 'This-is-one'
const decodeSlug = decodeURI(slugify(testCase))
t.true(decodeSlug === expectedString)
expect(decodeSlug === expectedString).toBe(true)
})
test('2-byte charactor support', t => {
test('2-byte charactor support', () => {
const testCase = '菠萝芒果テストÀžƁƵ'
const decodeSlug = decodeURI(slugify(testCase))
t.true(decodeSlug === testCase)
expect(decodeSlug === testCase).toBe(true)
})
test('emoji', t => {
test('emoji', () => {
const testCase = '🌸'
const decodeSlug = decodeURI(slugify(testCase))
t.true(decodeSlug === testCase)
expect(decodeSlug === testCase).toBe(true)
})