feat: add ci and op convert insert test

This commit is contained in:
cudr
2019-10-22 00:05:46 +03:00
parent 65bb9b134d
commit cc071a2d35
10 changed files with 101 additions and 8 deletions

View File

@@ -1,6 +1,8 @@
import toSync from './toSync'
import hexGen from './hexGen'
export * from './testUtils'
const toJS = node => {
try {
return JSON.parse(JSON.stringify(node))

View File

@@ -0,0 +1,24 @@
import * as Automerge from 'automerge'
import { ValueJSON, TextJSON, NodeJSON } from 'slate'
export const createTextJSON = (text: string = ''): TextJSON => ({
object: 'text',
marks: [],
text
})
export const createParagraphJSON = (text: string = ''): NodeJSON => ({
object: 'block',
type: 'paragraph',
nodes: [createTextJSON(text)]
})
export const createValueJSON = (): ValueJSON => ({
document: {
nodes: [createParagraphJSON()]
}
})
export const createDoc = () => Automerge.from(createValueJSON())
export const cloneDoc = doc => Automerge.change(doc, '', d => d)