Skip to content

Commit cfbbb80

Browse files
committed
coderabbit nits
1 parent f34275c commit cfbbb80

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

packages/database/features/step-definitions/stepdefs.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ When("user of space {word} creates group {word}", async (spaceName: string, name
412412
// eslint-disable-next-line @typescript-eslint/naming-convention
413413
const response = await client.functions.invoke<{group_id: string}>("create-group", {body:{name}});
414414
assert.equal(response.error, null);
415-
assert.notStrictEqual(response.data, null);
416-
localRefs[name] = response.data!.group_id;
415+
assert.ok(response.data?.group_id, "create-group response missing group_id");
416+
localRefs[name] = response.data.group_id;
417417
} catch (error) {
418418
console.error((error as Record<string, any>).actual);
419419
throw error;
@@ -423,21 +423,21 @@ When("user of space {word} creates group {word}", async (spaceName: string, name
423423
When("user of space {word} adds space {word} to group {word}",
424424
async (space1Name: string, space2Name:string, groupName: string)=>{
425425
const localRefs = (world.localRefs || {}) as Record<string, number|string>;
426-
const space1Id = localRefs[space1Name] as number;
427-
const space2Id = localRefs[space2Name] as number;
428-
const groupId = localRefs[groupName] as string;
429-
if (space1Id === undefined) assert.fail("space1Id");
430-
if (space2Id === undefined) assert.fail("space2Id");
431-
if (groupId === undefined) assert.fail("groupId");
432-
const client2 = await getLoggedinDatabase(space2Id);
426+
const space1Id = localRefs[space1Name];
427+
const space2Id = localRefs[space2Name];
428+
const groupId = localRefs[groupName];
429+
if (space1Id === undefined) assert.fail("space1Id not found");
430+
if (space2Id === undefined) assert.fail("space2Id not found");
431+
if (groupId === undefined) assert.fail("groupId not found");
432+
const client2 = await getLoggedinDatabase(space2Id as number);
433433
const r1 = await client2.from("PlatformAccount").select("dg_account").eq("account_local_id", spaceAnonUserEmail("Roam", space2Id)).maybeSingle();
434434
assert.equal(r1.error, null);
435435
const memberId = r1.data?.dg_account;
436-
assert(!!memberId);
437-
const client1 = await getLoggedinDatabase(space1Id);
436+
assert.ok(memberId, "memberId not found for space2");
437+
const client1 = await getLoggedinDatabase(space1Id as number);
438438
const r2 = await client1.from("group_membership").insert({
439439
/* eslint-disable @typescript-eslint/naming-convention */
440-
group_id: groupId,
440+
group_id: groupId as string,
441441
member_id: memberId
442442
/* eslint-enable @typescript-eslint/naming-convention */
443443
});

0 commit comments

Comments
 (0)