@@ -67,14 +67,17 @@ Given("the database is blank", async () => {
6767 assert . equal ( r . error , null ) ;
6868 const r3 = await client . from ( "group_membership" ) . select ( "group_id" ) ;
6969 assert . equal ( r3 . error , null ) ;
70- const groupIds = new Set ( ( r3 . data || [ ] ) . map ( ( { group_id} ) => group_id ) ) ;
70+ const groupIds = new Set ( ( r3 . data || [ ] ) . map ( ( { group_id } ) => group_id ) ) ;
7171 for ( const id of groupIds ) {
7272 const ur = await client . auth . admin . deleteUser ( id ) ;
7373 assert . equal ( ur . error , null ) ;
7474 }
75- const r2 = await client . from ( "PlatformAccount" ) . select ( "dg_account" ) . not ( 'dg_account' , 'is' , null ) ;
75+ const r2 = await client
76+ . from ( "PlatformAccount" )
77+ . select ( "dg_account" )
78+ . not ( "dg_account" , "is" , null ) ;
7679 assert . equal ( r2 . error , null ) ;
77- for ( const { dg_account} of r2 . data || [ ] ) {
80+ for ( const { dg_account } of r2 . data || [ ] ) {
7881 const r = await client . auth . admin . deleteUser ( dg_account ! ) ;
7982 assert . equal ( r . error , null ) ;
8083 }
@@ -296,7 +299,7 @@ Given(
296299 if ( typeof spaceId !== "number" ) assert . fail ( "spaceId not a number" ) ;
297300 const client = await getLoggedinDatabase ( spaceId ) ;
298301 const response = await client . rpc ( "upsert_accounts_in_space" , {
299- space_id_ : spaceId , // eslint-disable-line @typescript-eslint/naming-convention
302+ space_id_ : spaceId ,
300303 accounts,
301304 } ) ;
302305 assert . equal ( response . error , null ) ;
@@ -313,7 +316,7 @@ Given(
313316 if ( typeof spaceId !== "number" ) assert . fail ( "spaceId not a number" ) ;
314317 const client = await getLoggedinDatabase ( spaceId ) ;
315318 const response = await client . rpc ( "upsert_documents" , {
316- v_space_id : spaceId , // eslint-disable-line @typescript-eslint/naming-convention
319+ v_space_id : spaceId ,
317320 data,
318321 } ) ;
319322 assert . equal ( response . error , null ) ;
@@ -332,10 +335,10 @@ Given(
332335 if ( typeof userId !== "number" ) assert . fail ( "userId not a number" ) ;
333336 const client = await getLoggedinDatabase ( spaceId ) ;
334337 const response = await client . rpc ( "upsert_content" , {
335- v_space_id : spaceId , // eslint-disable-line @typescript-eslint/naming-convention
338+ v_space_id : spaceId ,
336339 data,
337- v_creator_id : userId , // eslint-disable-line @typescript-eslint/naming-convention
338- content_as_document : false , // eslint-disable-line @typescript-eslint/naming-convention
340+ v_creator_id : userId ,
341+ content_as_document : false ,
339342 } ) ;
340343 assert . equal ( response . error , null ) ;
341344 } ,
@@ -351,7 +354,7 @@ Given(
351354 if ( typeof spaceId !== "number" ) assert . fail ( "spaceId not a number" ) ;
352355 const client = await getLoggedinDatabase ( spaceId ) ;
353356 const response = await client . rpc ( "upsert_concepts" , {
354- v_space_id : spaceId , // eslint-disable-line @typescript-eslint/naming-convention
357+ v_space_id : spaceId ,
355358 data,
356359 } ) ;
357360 assert . equal ( response . error , null ) ;
@@ -404,47 +407,60 @@ Then("query results should look like this", (table: DataTable) => {
404407 }
405408} ) ;
406409
407- When ( "user of space {word} creates group {word}" , async ( spaceName : string , name : string ) => {
408- const localRefs = ( world . localRefs || { } ) as LocalRefsType ;
409- const spaceId = localRefs [ spaceName ] ;
410- if ( typeof spaceId !== "number" ) assert . fail ( "spaceId not a number" ) ;
411- const client = await getLoggedinDatabase ( spaceId ) ;
412- try {
413- // eslint-disable-next-line @typescript-eslint/naming-convention
414- const response = await client . functions . invoke < { group_id : string } > ( "create-group" , { body :{ name} } ) ;
415- assert . equal ( response . error , null ) ;
416- assert . ok ( response . data ?. group_id , "create-group response missing group_id" ) ;
417- localRefs [ name ] = response . data . group_id ;
418- world . localRefs = localRefs ;
419- } catch ( error ) {
420- console . error ( ( error as Record < string , any > ) . actual ) ;
421- throw error ;
422- }
423- } )
410+ When (
411+ "user of space {word} creates group {word}" ,
412+ async ( spaceName : string , name : string ) => {
413+ const localRefs = ( world . localRefs || { } ) as LocalRefsType ;
414+ const spaceId = localRefs [ spaceName ] ;
415+ if ( typeof spaceId !== "number" ) assert . fail ( "spaceId not a number" ) ;
416+ const client = await getLoggedinDatabase ( spaceId ) ;
417+ try {
418+ const response = await client . functions . invoke < { group_id : string } > (
419+ "create-group" ,
420+ { body : { name } } ,
421+ ) ;
422+ assert . equal ( response . error , null ) ;
423+ assert . ok (
424+ response . data ?. group_id ,
425+ "create-group response missing group_id" ,
426+ ) ;
427+ localRefs [ name ] = response . data . group_id ;
428+ world . localRefs = localRefs ;
429+ } catch ( error ) {
430+ console . error ( ( error as Record < string , any > ) . actual ) ;
431+ throw error ;
432+ }
433+ } ,
434+ ) ;
424435
425- When ( "user of space {word} adds space {word} to group {word}" ,
426- async ( space1Name : string , space2Name :string , groupName : string ) : Promise < void > => {
427- const localRefs = ( world . localRefs || { } ) as LocalRefsType ;
428- const space1Id = localRefs [ space1Name ] ;
429- const space2Id = localRefs [ space2Name ] ;
430- const groupId = localRefs [ groupName ] ;
431- if ( typeof space1Id !== 'number' ) assert . fail ( "space1Id not a number" ) ;
432- if ( typeof space2Id !== 'number' ) assert . fail ( "space2Id not a number" ) ;
433- if ( typeof groupId !== 'string' ) assert . fail ( "groupId not a string" ) ;
434- const client2 = await getLoggedinDatabase ( space2Id ) ;
435- const r1 = await client2 . from ( "PlatformAccount" )
436+ When (
437+ "user of space {word} adds space {word} to group {word}" ,
438+ async (
439+ space1Name : string ,
440+ space2Name : string ,
441+ groupName : string ,
442+ ) : Promise < void > => {
443+ const localRefs = ( world . localRefs || { } ) as LocalRefsType ;
444+ const space1Id = localRefs [ space1Name ] ;
445+ const space2Id = localRefs [ space2Name ] ;
446+ const groupId = localRefs [ groupName ] ;
447+ if ( typeof space1Id !== "number" ) assert . fail ( "space1Id not a number" ) ;
448+ if ( typeof space2Id !== "number" ) assert . fail ( "space2Id not a number" ) ;
449+ if ( typeof groupId !== "string" ) assert . fail ( "groupId not a string" ) ;
450+ const client2 = await getLoggedinDatabase ( space2Id ) ;
451+ const r1 = await client2
452+ . from ( "PlatformAccount" )
436453 . select ( "dg_account" )
437454 . eq ( "account_local_id" , spaceAnonUserEmail ( "Roam" , space2Id ) )
438455 . maybeSingle ( ) ;
439- assert . equal ( r1 . error , null ) ;
440- const memberId = r1 . data ?. dg_account ;
441- assert . ok ( memberId , "memberId not found for space2" ) ;
442- const client1 = await getLoggedinDatabase ( space1Id ) ;
443- const r2 = await client1 . from ( "group_membership" ) . insert ( {
444- /* eslint-disable @typescript-eslint/naming-convention */
445- group_id : groupId ,
446- member_id : memberId
447- /* eslint-enable @typescript-eslint/naming-convention */
448- } ) ;
449- assert . equal ( r2 . error , null ) ;
450- } )
456+ assert . equal ( r1 . error , null ) ;
457+ const memberId = r1 . data ?. dg_account ;
458+ assert . ok ( memberId , "memberId not found for space2" ) ;
459+ const client1 = await getLoggedinDatabase ( space1Id ) ;
460+ const r2 = await client1 . from ( "group_membership" ) . insert ( {
461+ group_id : groupId ,
462+ member_id : memberId ,
463+ } ) ;
464+ assert . equal ( r2 . error , null ) ;
465+ } ,
466+ ) ;
0 commit comments