Skip to content

Commit 8e3e855

Browse files
committed
tests pass
1 parent 655b88d commit 8e3e855

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/lib/actions/__tests__/ignore.test.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ describe("Ignore action tests", () => {
158158
}
159159

160160
room_id = data?.room_id;
161+
console.log("*** data", data);
162+
console.log("Room ID", room_id);
161163

162164
await cleanup();
163165
});
@@ -187,7 +189,7 @@ describe("Ignore action tests", () => {
187189

188190
return result.action === "IGNORE";
189191
});
190-
}, 60000);
192+
}, 120000);
191193

192194
test("Action handler test 1: response should be ignore", async () => {
193195
await runAiTest(
@@ -212,7 +214,7 @@ describe("Ignore action tests", () => {
212214
return (lastMessage.content as Content).action === "IGNORE";
213215
},
214216
);
215-
}, 60000);
217+
}, 120000);
216218

217219
test("Action handler test 2: response should be ignore", async () => {
218220
await runAiTest(
@@ -237,7 +239,7 @@ describe("Ignore action tests", () => {
237239
return (lastMessage.content as Content).action === "IGNORE";
238240
},
239241
);
240-
}, 60000);
242+
}, 120000);
241243

242244
test("Expect ignore", async () => {
243245
await runAiTest("Expect ignore", async () => {
@@ -257,5 +259,5 @@ describe("Ignore action tests", () => {
257259

258260
return (lastMessage.content as Content).action === "IGNORE";
259261
});
260-
}, 60000);
262+
}, 120000);
261263
});

src/lib/adapters/sqlite.ts

+1
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ AND room_id = ?`;
425425
}
426426

427427
async createRoom(room_id?: UUID): Promise<UUID> {
428+
room_id = room_id || (v4() as UUID);
428429
try {
429430
const sql = "INSERT INTO rooms (id) VALUES (?)";
430431
this.db.prepare(sql).run(room_id ?? (v4() as UUID));

src/test/getOrCreateRelationship.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ export async function getOrCreateRelationship({
2525

2626
let room_id: UUID;
2727
if (!rooms || rooms.length === 0) {
28+
console.log("No room found for participants");
2829
// If no room exists, create a new room for the relationship
2930
room_id = await runtime.databaseAdapter.createRoom();
31+
console.log("Created room", room_id);
3032

3133
// Add participants to the newly created room
3234
await runtime.databaseAdapter.addParticipant(userA, room_id);
3335
await runtime.databaseAdapter.addParticipant(userB, room_id);
3436
} else {
37+
console.log("Room found for participants", rooms[0]);
3538
// If a room already exists, use the existing room
3639
room_id = rooms[0];
3740
}
@@ -49,5 +52,5 @@ export async function getOrCreateRelationship({
4952
throw new Error("Failed to fetch the created relationship");
5053
}
5154
}
52-
return { ...relationship, room_id: room_id };
55+
return { ...relationship, room_id };
5356
}

0 commit comments

Comments
 (0)