@@ -11,6 +11,7 @@ import {
1111 createFolder ,
1212 createNote ,
1313 createSidebarShare ,
14+ syncBlocksToYjs ,
1415 testBlockNoteId ,
1516} from '../../_test/factories.helper'
1617import { api } from '../../_generated/api'
@@ -30,6 +31,9 @@ describe('note lifecycle: create, share, edit, block sharing', () => {
3031 const block = await createBlock ( t , note . noteId , ctx . campaignId , ctx . dm . profile . _id , {
3132 blockNoteId : testBlockNoteId ( 'secret-block' ) ,
3233 } )
34+ await syncBlocksToYjs ( t , note . noteId , [
35+ { id : testBlockNoteId ( 'secret-block' ) , type : 'paragraph' } ,
36+ ] )
3337
3438 await createSidebarShare ( t , ctx . dm . profile . _id , {
3539 campaignId : ctx . campaignId ,
@@ -92,6 +96,9 @@ describe('note lifecycle: create, share, edit, block sharing', () => {
9296 const block = await createBlock ( t , note . noteId , ctx . campaignId , ctx . dm . profile . _id , {
9397 blockNoteId : testBlockNoteId ( 'revocable-block' ) ,
9498 } )
99+ await syncBlocksToYjs ( t , note . noteId , [
100+ { id : testBlockNoteId ( 'revocable-block' ) , type : 'paragraph' } ,
101+ ] )
95102
96103 await createSidebarShare ( t , ctx . dm . profile . _id , {
97104 campaignId : ctx . campaignId ,
@@ -161,6 +168,7 @@ describe('note lifecycle: create, share, edit, block sharing', () => {
161168 const block = await createBlock ( t , noteId , ctx . campaignId , ctx . dm . profile . _id , {
162169 blockNoteId : testBlockNoteId ( 'nested-block' ) ,
163170 } )
171+ await syncBlocksToYjs ( t , noteId , [ { id : testBlockNoteId ( 'nested-block' ) , type : 'paragraph' } ] )
164172
165173 const playerNoteWithBlocks = await playerAuth . query ( api . notes . queries . getNote , {
166174 campaignId : ctx . campaignId ,
@@ -228,6 +236,9 @@ describe('note lifecycle: create, share, edit, block sharing', () => {
228236 const block = await createBlock ( t , note . noteId , ctx . campaignId , ctx . dm . profile . _id , {
229237 blockNoteId : testBlockNoteId ( 'transition-block' ) ,
230238 } )
239+ await syncBlocksToYjs ( t , note . noteId , [
240+ { id : testBlockNoteId ( 'transition-block' ) , type : 'paragraph' } ,
241+ ] )
231242
232243 await createSidebarShare ( t , ctx . dm . profile . _id , {
233244 campaignId : ctx . campaignId ,
@@ -304,6 +315,16 @@ describe('note lifecycle: create, share, edit, block sharing', () => {
304315 parentBlockId : testBlockNoteId ( 'root' ) ,
305316 position : 1 ,
306317 } )
318+ await syncBlocksToYjs ( t , note . noteId , [
319+ {
320+ id : testBlockNoteId ( 'root' ) ,
321+ type : 'paragraph' ,
322+ children : [
323+ { id : testBlockNoteId ( 'shared-child' ) , type : 'paragraph' } ,
324+ { id : testBlockNoteId ( 'unshared-child' ) , type : 'paragraph' } ,
325+ ] ,
326+ } ,
327+ ] )
307328
308329 await createSidebarShare ( t , ctx . dm . profile . _id , {
309330 campaignId : ctx . campaignId ,
0 commit comments