import { rebuild } from '../src/rebuild'; import { NodeType } from '../src/types'; describe('rebuild', () => { it('should rebuild a text node', () => { const snapshot = { type: NodeType.Text as const, textContent: 'hello', id: '1', } const node = rebuild(snapshot, { doc: document })!; expect(node.textContent).toBe('hello'); }); it('should rebuild a text node with undefined text content', () => { const snapshot = { type: NodeType.Text as const, id: '1', } const node = rebuild(snapshot, { doc: document })!; expect(node.textContent).toBe(''); }); });