mirror of
https://github.com/cudr/slate-collaborative.git
synced 2025-06-13 12:54:04 +00:00
chore: code commenting
This commit is contained in:
parent
d0a7930484
commit
adc7ac7dbf
@ -1,5 +1,8 @@
|
|||||||
import AutomergeBackend from '../AutomergeBackend'
|
import AutomergeBackend from '../AutomergeBackend'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of active connections for the specified docId
|
||||||
|
*/
|
||||||
const getActiveConnections = (backend: AutomergeBackend, docId: string) => {
|
const getActiveConnections = (backend: AutomergeBackend, docId: string) => {
|
||||||
const automergeDocument = backend.documentSetMap[docId]
|
const automergeDocument = backend.documentSetMap[docId]
|
||||||
|
|
||||||
|
@ -75,10 +75,14 @@ describe('automerge editor client tests', () => {
|
|||||||
|
|
||||||
let collabEditors: (Editor & WithSocketIOEditor & AutomergeEditor)[] = []
|
let collabEditors: (Editor & WithSocketIOEditor & AutomergeEditor)[] = []
|
||||||
afterEach(done => {
|
afterEach(done => {
|
||||||
|
// Clear our operation traces after each test
|
||||||
operationTraces = []
|
operationTraces = []
|
||||||
|
|
||||||
|
// Destroy any created collab editors after each test
|
||||||
collabEditors.forEach(editor => editor.destroy())
|
collabEditors.forEach(editor => editor.destroy())
|
||||||
collabEditors = []
|
collabEditors = []
|
||||||
|
|
||||||
|
// Ensure that the collab document has been cleaned up on the backend
|
||||||
waitForCondition(() => !collabBackend.backend.getDocument(docId)).then(done)
|
waitForCondition(() => !collabBackend.backend.getDocument(docId)).then(done)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -276,7 +280,7 @@ describe('automerge editor client tests', () => {
|
|||||||
|
|
||||||
it('should reconnect with no opCount', async () => {
|
it('should reconnect with no opCount', async () => {
|
||||||
const editor1 = await createCollabEditor({ resetOnReconnect: true })
|
const editor1 = await createCollabEditor({ resetOnReconnect: true })
|
||||||
console.log('----\neditor1 disconnect\n-----')
|
|
||||||
await waitForCondition(() => {
|
await waitForCondition(() => {
|
||||||
return getActiveConnections(collabBackend.backend, docId) === 1
|
return getActiveConnections(collabBackend.backend, docId) === 1
|
||||||
})
|
})
|
||||||
@ -287,7 +291,6 @@ describe('automerge editor client tests', () => {
|
|||||||
() => getActiveConnections(collabBackend.backend, docId) === 0
|
() => getActiveConnections(collabBackend.backend, docId) === 0
|
||||||
)
|
)
|
||||||
|
|
||||||
console.log('----\neditor1 reconnect\n-----')
|
|
||||||
editor1.connect()
|
editor1.connect()
|
||||||
|
|
||||||
await waitForCondition(
|
await waitForCondition(
|
||||||
|
Loading…
Reference in New Issue
Block a user