@@ -23,6 +23,7 @@ import {
2323 cleanupRunners ,
2424} from "../../helpers/command-helpers.js" ;
2525import type { CliRunner } from "../../helpers/cli-runner.js" ;
26+ import { parseNdjsonLines } from "../../helpers/ndjson.js" ;
2627
2728describe . skipIf ( SHOULD_SKIP_E2E ) (
2829 "Spaces Locations, Cursors, and Locks E2E Tests" ,
@@ -92,6 +93,19 @@ describe.skipIf(SHOULD_SKIP_E2E)(
9293 ) ;
9394
9495 expect ( getResult . exitCode ) . toBe ( 0 ) ;
96+
97+ const records = parseNdjsonLines ( getResult . stdout ) ;
98+ const resultRecord = records . find ( ( r ) => r . type === "result" ) ;
99+ expect ( resultRecord ) . toBeDefined ( ) ;
100+ expect ( resultRecord ! . success ) . toBe ( true ) ;
101+ const locations = resultRecord ! . locations as Array < {
102+ connectionId : string ;
103+ location : unknown ;
104+ } > ;
105+ expect ( locations ) . toBeDefined ( ) ;
106+ expect ( locations . length ) . toBeGreaterThan ( 0 ) ;
107+ expect ( locations [ 0 ] ) . toHaveProperty ( "connectionId" ) ;
108+ expect ( locations [ 0 ] ) . toHaveProperty ( "location" ) ;
95109 } finally {
96110 if ( locationRunner ) {
97111 await cleanupRunners ( [ locationRunner ] ) ;
@@ -144,6 +158,19 @@ describe.skipIf(SHOULD_SKIP_E2E)(
144158 ) ;
145159
146160 expect ( getResult . exitCode ) . toBe ( 0 ) ;
161+
162+ const cursorRecords = parseNdjsonLines ( getResult . stdout ) ;
163+ const cursorResult = cursorRecords . find ( ( r ) => r . type === "result" ) ;
164+ expect ( cursorResult ) . toBeDefined ( ) ;
165+ expect ( cursorResult ! . success ) . toBe ( true ) ;
166+ const cursors = cursorResult ! . cursors as Array < {
167+ position : { x : number ; y : number } ;
168+ } > ;
169+ expect ( cursors ) . toBeDefined ( ) ;
170+ expect ( cursors . length ) . toBeGreaterThan ( 0 ) ;
171+ expect ( cursors [ 0 ] . position ) . toBeDefined ( ) ;
172+ expect ( typeof cursors [ 0 ] . position . x ) . toBe ( "number" ) ;
173+ expect ( typeof cursors [ 0 ] . position . y ) . toBe ( "number" ) ;
147174 } finally {
148175 if ( cursorRunner ) {
149176 await cleanupRunners ( [ cursorRunner ] ) ;
@@ -195,6 +222,24 @@ describe.skipIf(SHOULD_SKIP_E2E)(
195222 ) ;
196223
197224 expect ( getResult . exitCode ) . toBe ( 0 ) ;
225+
226+ const lockRecords = parseNdjsonLines ( getResult . stdout ) ;
227+ const lockResult = lockRecords . find ( ( r ) => r . type === "result" ) ;
228+ expect ( lockResult ) . toBeDefined ( ) ;
229+ expect ( lockResult ! . success ) . toBe ( true ) ;
230+ const locks = lockResult ! . locks as Array < {
231+ id : string ;
232+ status : string ;
233+ member : { clientId : string } ;
234+ timestamp : string ;
235+ } > ;
236+ expect ( locks ) . toBeDefined ( ) ;
237+ expect ( locks . length ) . toBeGreaterThan ( 0 ) ;
238+ expect ( locks [ 0 ] . id ) . toBe ( "test-lock-1" ) ;
239+ expect ( locks [ 0 ] . status ) . toBe ( "locked" ) ;
240+ expect ( locks [ 0 ] . member ) . toBeDefined ( ) ;
241+ expect ( locks [ 0 ] . member . clientId ) . toBe ( clientId ) ;
242+ expect ( locks [ 0 ] . timestamp ) . toBeDefined ( ) ;
198243 } finally {
199244 if ( lockRunner ) {
200245 await cleanupRunners ( [ lockRunner ] ) ;
0 commit comments