128 lines
3.7 KiB
JavaScript
128 lines
3.7 KiB
JavaScript
const TestBaseClient = require("./testbase");
|
|
|
|
// const userA = "6516_2006_0xef59f6cc4d190a0ae576c46d4583e92b61174340";
|
|
const userA = "6517_2006_0_104162729566475397176";
|
|
const userB = "6513_2006_md9nVaGIooStTM1D56NLblLosFhWhgxB";
|
|
|
|
|
|
describe("chat", () => {
|
|
let msg;
|
|
const tbc = new TestBaseClient();
|
|
|
|
test("entry", async () => {
|
|
await tbc.init(userA);
|
|
msg = await tbc.rpc("connector.entryHandler.entry", { uid: userA, });
|
|
console.log(msg);
|
|
expect(msg.code).toBe(200);
|
|
});
|
|
|
|
test("join world channel", async () => {
|
|
msg = await tbc.rpc("chat.chatHandler.joinWorldChannel", { channel: "world", });
|
|
console.log(msg);
|
|
expect(msg.code).toBe(200);
|
|
} );
|
|
|
|
test("word chat", async () => {
|
|
msg = await tbc.rpc("chat.chatHandler.worldChat", { content: "hello" });
|
|
console.log(msg);
|
|
const result = await tbc.on("onChat");
|
|
console.log(result);
|
|
expect(msg.code).toBe(200);
|
|
expect(result.content).toBe("hello");
|
|
});
|
|
|
|
test("word chat1", async () => {
|
|
msg = await tbc.rpc("chat.chatHandler.worldChat", { content: "hello1" });
|
|
console.log(msg);
|
|
const result = await tbc.on("onChat");
|
|
console.log(result);
|
|
expect(msg.code).toBe(200);
|
|
expect(result.content).toBe("hello1");
|
|
});
|
|
|
|
test("word chat2", async () => {
|
|
msg = await tbc.rpc("chat.chatHandler.worldChat", { content: "hello2" });
|
|
console.log(msg);
|
|
const result = await tbc.on("onChat");
|
|
console.log(result);
|
|
expect(msg.code).toBe(200);
|
|
expect(result.content).toBe("hello2");
|
|
});
|
|
|
|
test("word chat3", async () => {
|
|
msg = await tbc.rpc("chat.chatHandler.worldChat", { content: "hello3" });
|
|
console.log(msg);
|
|
const result = await tbc.on("onChat");
|
|
console.log(result);
|
|
expect(msg.code).toBe(200);
|
|
expect(result.content).toBe("hello3");
|
|
});
|
|
|
|
test("word chat4", async () => {
|
|
msg = await tbc.rpc("chat.chatHandler.worldChat", { content: "hello4" });
|
|
console.log(msg);
|
|
const result = await tbc.on("onChat");
|
|
console.log(result);
|
|
expect(msg.code).toBe(200);
|
|
expect(result.content).toBe("hello4");
|
|
});
|
|
|
|
test("word chat5", async () => {
|
|
msg = await tbc.rpc("chat.chatHandler.worldChat", { content: "hello5" });
|
|
console.log(msg);
|
|
const result = await tbc.on("onChat");
|
|
console.log(result);
|
|
expect(msg.code).toBe(200);
|
|
expect(result.content).toBe("hello5");
|
|
});
|
|
|
|
test("word chat6", async () => {
|
|
msg = await tbc.rpc("chat.chatHandler.worldChat", { content: "hello6" });
|
|
console.log(msg);
|
|
const result = await tbc.on("onChat");
|
|
console.log(result);
|
|
expect(msg.code).toBe(200);
|
|
expect(result.content).toBe("hello6");
|
|
});
|
|
|
|
test("word chat7", async () => {
|
|
msg = await tbc.rpc("chat.chatHandler.worldChat", { content: "hello7" });
|
|
console.log(msg);
|
|
const result = await tbc.on("onChat");
|
|
console.log(result);
|
|
expect(msg.code).toBe(200);
|
|
expect(result.content).toBe("hello7");
|
|
});
|
|
|
|
test("word chat8", async () => {
|
|
msg = await tbc.rpc("chat.chatHandler.worldChat", { content: "hello8" });
|
|
console.log(msg);
|
|
const result = await tbc.on("onChat");
|
|
console.log(result);
|
|
expect(msg.code).toBe(200);
|
|
});
|
|
|
|
test("word chat9", async () => {
|
|
msg = await tbc.rpc("chat.chatHandler.worldChat", { content: "hello9" });
|
|
console.log(msg);
|
|
const result = await tbc.on("onChat");
|
|
console.log(result);
|
|
expect(msg.code).toBe(200);
|
|
expect(result.content).toBe("hello9");
|
|
});
|
|
|
|
test("word chat10", async () => {
|
|
msg = await tbc.rpc("chat.chatHandler.worldChat", { content: "hello10" });
|
|
console.log(msg);
|
|
const result = await tbc.on("onChat");
|
|
console.log(result);
|
|
expect(msg.code).toBe(200);
|
|
expect(result.content).toBe("hello10");
|
|
});
|
|
|
|
test('end', async()=>{
|
|
tbc.destroy();
|
|
})
|
|
|
|
});
|