@@ -24,6 +24,7 @@ import {
2424 cleanupRunners ,
2525} from "../../helpers/command-helpers.js" ;
2626import type { CliRunner } from "../../helpers/cli-runner.js" ;
27+ import { parseNdjsonLines } from "../../helpers/ndjson.js" ;
2728
2829describe . skipIf ( SHOULD_SKIP_E2E ) (
2930 "Spaces Locations, Cursors, and Locks E2E Tests" ,
@@ -93,6 +94,19 @@ describe.skipIf(SHOULD_SKIP_E2E)(
9394 ) ;
9495
9596 expect ( getResult . exitCode ) . toBe ( 0 ) ;
97+
98+ const records = parseNdjsonLines ( getResult . stdout ) ;
99+ const resultRecord = records . find ( ( r ) => r . type === "result" ) ;
100+ expect ( resultRecord ) . toBeDefined ( ) ;
101+ expect ( resultRecord ! . success ) . toBe ( true ) ;
102+ const locations = resultRecord ! . locations as Array < {
103+ connectionId : string ;
104+ location : unknown ;
105+ } > ;
106+ expect ( locations ) . toBeDefined ( ) ;
107+ expect ( locations . length ) . toBeGreaterThan ( 0 ) ;
108+ expect ( locations [ 0 ] ) . toHaveProperty ( "connectionId" ) ;
109+ expect ( locations [ 0 ] ) . toHaveProperty ( "location" ) ;
96110 } finally {
97111 if ( locationRunner ) {
98112 await cleanupRunners ( [ locationRunner ] ) ;
@@ -172,6 +186,19 @@ describe.skipIf(SHOULD_SKIP_E2E)(
172186 ) ;
173187
174188 expect ( getResult . exitCode ) . toBe ( 0 ) ;
189+
190+ const cursorRecords = parseNdjsonLines ( getResult . stdout ) ;
191+ const cursorResult = cursorRecords . find ( ( r ) => r . type === "result" ) ;
192+ expect ( cursorResult ) . toBeDefined ( ) ;
193+ expect ( cursorResult ! . success ) . toBe ( true ) ;
194+ const cursors = cursorResult ! . cursors as Array < {
195+ position : { x : number ; y : number } ;
196+ } > ;
197+ expect ( cursors ) . toBeDefined ( ) ;
198+ expect ( cursors . length ) . toBeGreaterThan ( 0 ) ;
199+ expect ( cursors [ 0 ] . position ) . toBeDefined ( ) ;
200+ expect ( typeof cursors [ 0 ] . position . x ) . toBe ( "number" ) ;
201+ expect ( typeof cursors [ 0 ] . position . y ) . toBe ( "number" ) ;
175202 } finally {
176203 const runners : CliRunner [ ] = [ ] ;
177204 if ( subscriberRunner ) runners . push ( subscriberRunner ) ;
@@ -224,6 +251,24 @@ describe.skipIf(SHOULD_SKIP_E2E)(
224251 ) ;
225252
226253 expect ( getResult . exitCode ) . toBe ( 0 ) ;
254+
255+ const lockRecords = parseNdjsonLines ( getResult . stdout ) ;
256+ const lockResult = lockRecords . find ( ( r ) => r . type === "result" ) ;
257+ expect ( lockResult ) . toBeDefined ( ) ;
258+ expect ( lockResult ! . success ) . toBe ( true ) ;
259+ const locks = lockResult ! . locks as Array < {
260+ id : string ;
261+ status : string ;
262+ member : { clientId : string } ;
263+ timestamp : string ;
264+ } > ;
265+ expect ( locks ) . toBeDefined ( ) ;
266+ expect ( locks . length ) . toBeGreaterThan ( 0 ) ;
267+ expect ( locks [ 0 ] . id ) . toBe ( "test-lock-1" ) ;
268+ expect ( locks [ 0 ] . status ) . toBe ( "locked" ) ;
269+ expect ( locks [ 0 ] . member ) . toBeDefined ( ) ;
270+ expect ( locks [ 0 ] . member . clientId ) . toBe ( clientId ) ;
271+ expect ( locks [ 0 ] . timestamp ) . toBeDefined ( ) ;
227272 } finally {
228273 if ( lockRunner ) {
229274 await cleanupRunners ( [ lockRunner ] ) ;
0 commit comments