Skip to content

Commit 1de6f12

Browse files
committedJan 25, 2025·
test suites
1 parent 4d3bbc2 commit 1de6f12

File tree

2 files changed

+3
-54
lines changed

2 files changed

+3
-54
lines changed
 
+1-44
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { generatePrivateKey } from "viem/accounts";
22
import { describe, expect, test } from "vitest";
3-
import type { Message } from "../src/lib/types";
43
import { createUser, XMTP, xmtpClient } from "../src/lib/xmtp";
54

65
describe("Client Private Key Configuration Tests", () => {
@@ -30,7 +29,7 @@ describe("Client Private Key Configuration Tests", () => {
3029
}, 15000); // Added 15 second timeout
3130

3231
test("Creates a key with a agent name", async () => {
33-
const agentName = "bob1";
32+
const agentName = "bob3";
3433
const xmtp = await xmtpClient({
3534
name: agentName,
3635
});
@@ -53,46 +52,4 @@ describe("Client Private Key Configuration Tests", () => {
5352
expect((error as Error).message).toContain("invalid private key");
5453
}
5554
}, 15000); // Added 15 second timeout
56-
57-
test("Creates a key with a agent name", async () => {
58-
const agentName = "bob1";
59-
const xmtp = await xmtpClient({
60-
name: agentName,
61-
onMessage: async (message: Message) => {
62-
await new Promise((resolve) => setTimeout(resolve, 1000));
63-
console.log(
64-
"message received",
65-
message.content.text,
66-
"from",
67-
message.sender.address,
68-
);
69-
},
70-
});
71-
const xmtp2 = await xmtpClient({
72-
name: "alice1",
73-
onMessage: async (message: Message) => {
74-
await new Promise((resolve) => setTimeout(resolve, 1000));
75-
console.log(
76-
"message received",
77-
message.content.text,
78-
"from",
79-
message.sender.address,
80-
);
81-
},
82-
});
83-
84-
const message1 = await xmtp.send({
85-
message: "Hello, Alice!",
86-
receivers: [xmtp2.inboxId || ""],
87-
metadata: {},
88-
});
89-
const message2 = await xmtp2.send({
90-
message: "Hello, Bob!",
91-
receivers: [xmtp.inboxId || ""],
92-
metadata: {},
93-
});
94-
95-
expect(message1).toBeDefined();
96-
expect(message2).toBeDefined();
97-
}, 15000);
9855
});

‎packages/agent-starter/tests/Message.test.ts

+2-10
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ describe("Client Private Key Configuration Tests", async () => {
66
const xmtp = await xmtpClient({
77
name: "bob2",
88
onMessage: async (message: Message) => {
9-
console.log(
10-
"Bob received message:",
11-
message.content.text,
12-
"from",
13-
message.sender.address,
14-
);
159
await new Promise((resolve) => setTimeout(resolve, 1000));
1610
expect(message.content.text).toBe("Hello, Alice!");
1711
expect(message.sender.address).toBe(xmtp2.address);
@@ -35,8 +29,6 @@ describe("Client Private Key Configuration Tests", async () => {
3529
});
3630

3731
test("Send a message to a client", async () => {
38-
console.log("Bob's address:", xmtp.address);
39-
console.log("Alice's address:", xmtp2.address);
4032
const message = await xmtp.send({
4133
message: "Hello, Alice!",
4234
receivers: [xmtp2.address as string],
@@ -47,7 +39,7 @@ describe("Client Private Key Configuration Tests", async () => {
4739
receivers: [xmtp.address as string],
4840
metadata: {},
4941
});
50-
console.log("Message sent:", message);
51-
console.log("Message sent:", message2);
42+
expect(message).toBeDefined();
43+
expect(message2).toBeDefined();
5244
}, 25000);
5345
});

0 commit comments

Comments
 (0)
Please sign in to comment.