mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 11:37:02 -04:00
refactor(frontend/commons): rename .test files to .spec
Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
24b7514e25
commit
4956a99ced
144 changed files with 84 additions and 84 deletions
36
commons/src/y-doc-sync/realtime-doc.spec.ts
Normal file
36
commons/src/y-doc-sync/realtime-doc.spec.ts
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { RealtimeDoc } from './realtime-doc.js'
|
||||
import { describe, expect, it } from '@jest/globals'
|
||||
|
||||
describe('realtime doc', () => {
|
||||
it('saves an initial text content correctly', () => {
|
||||
const textContent = 'textContent'
|
||||
const realtimeDoc = new RealtimeDoc(textContent)
|
||||
expect(realtimeDoc.getCurrentContent()).toBe(textContent)
|
||||
})
|
||||
|
||||
it('will initialize an empty text if no initial content is given', () => {
|
||||
const realtimeDoc = new RealtimeDoc()
|
||||
expect(realtimeDoc.getCurrentContent()).toBe('')
|
||||
})
|
||||
|
||||
it('restores a yjs state vector update correctly', () => {
|
||||
const realtimeDoc = new RealtimeDoc(
|
||||
'notTheVectorText',
|
||||
[
|
||||
1, 1, 221, 208, 165, 230, 3, 0, 4, 1, 15, 109, 97, 114, 107, 100, 111,
|
||||
119, 110, 67, 111, 110, 116, 101, 110, 116, 32, 116, 101, 120, 116, 67,
|
||||
111, 110, 116, 101, 110, 116, 70, 114, 111, 109, 83, 116, 97, 116, 101,
|
||||
86, 101, 99, 116, 111, 114, 85, 112, 100, 97, 116, 101, 0
|
||||
]
|
||||
)
|
||||
|
||||
expect(realtimeDoc.getCurrentContent()).toBe(
|
||||
'textContentFromStateVectorUpdate'
|
||||
)
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue