mirror of
https://github.com/cudr/slate-collaborative.git
synced 2024-10-27 20:34:06 +00:00
chore: minimal reproduction of large diff on reconnect
This commit is contained in:
parent
513770336a
commit
581d68b142
@ -22,7 +22,7 @@
|
||||
"build:types": "tsc --emitDeclarationOnly",
|
||||
"build:js": "babel src --out-dir lib --extensions \".ts,.tsx\" --source-maps inline",
|
||||
"watch": "yarn build:js -w",
|
||||
"test": "jest"
|
||||
"test": "DEBUG=app* jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.9.0",
|
||||
|
@ -41,7 +41,12 @@ const server = createServer(function(req, res) {
|
||||
res.end()
|
||||
})
|
||||
|
||||
const defaultSlateJson = [{ type: 'paragraph', children: [{ text: '' }] }]
|
||||
const defaultSlateJson = [
|
||||
{
|
||||
type: 'paragraph',
|
||||
children: [{ text: 'hello world' }, { text: 'goodbye world' }]
|
||||
}
|
||||
]
|
||||
const collabBackend = new AutomergeCollaboration({
|
||||
entry: server,
|
||||
defaultValue: defaultSlateJson,
|
||||
@ -280,37 +285,27 @@ describe('automerge editor client tests', () => {
|
||||
|
||||
it.only('should work with concurrent insert text operations', async () => {
|
||||
const editor1 = await createCollabEditor()
|
||||
const editor2 = await createCollabEditor()
|
||||
console.log('----\neditor1 disconnect\n-----')
|
||||
await waitForCondition(() => {
|
||||
return getActiveConnections(collabBackend.backend, docId) === 1
|
||||
})
|
||||
|
||||
editor1.disconnect()
|
||||
|
||||
await waitForCondition(() => {
|
||||
return getActiveConnections(collabBackend.backend, docId) === 1
|
||||
})
|
||||
|
||||
// editor2.insertNode({ type: 'paragraph', children: [{ text: 'hi' }] })
|
||||
// await waitForCondition(() => {
|
||||
// return collabBackend.backend.getDocument(docId)?.children.length === 1
|
||||
// })
|
||||
await waitForCondition(
|
||||
() => getActiveConnections(collabBackend.backend, docId) === 0
|
||||
)
|
||||
|
||||
console.log('----\neditor1 reconnect\n-----')
|
||||
editor1.connect()
|
||||
|
||||
await waitForCondition(
|
||||
() => getActiveConnections(collabBackend.backend, docId) === 2
|
||||
() => getActiveConnections(collabBackend.backend, docId) === 1
|
||||
)
|
||||
|
||||
// await waitForCondition(() => {
|
||||
// return editor1.children.length === 1
|
||||
// })
|
||||
|
||||
editor2.destroy()
|
||||
|
||||
await waitForCondition(() => {
|
||||
return getActiveConnections(collabBackend.backend, docId) === 1
|
||||
})
|
||||
await new Promise(res => setTimeout(res, 3000))
|
||||
|
||||
console.log('destroying last editor')
|
||||
|
||||
editor1.destroy()
|
||||
|
||||
await waitForCondition(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user