1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-02 01:33:22 +00:00

feat: add async function calling test

This commit is contained in:
Andreas Coroiu
2025-10-27 09:40:35 +01:00
parent c415e2ae48
commit 2de3c690f3

View File

@@ -30,6 +30,14 @@ describe("RpcServer", () => {
expect(result).toBe("Hello, World!");
});
it("calls async function and returns value", async () => {
const remoteInstance = await firstValueFrom(client.getRoot());
const result = await remoteInstance.greetAsync("Async World");
expect(result).toBe("Hello, Async World!");
});
});
class TestClass {
@@ -38,6 +46,10 @@ class TestClass {
greet(name: string): string {
return `Hello, ${name}!`;
}
async greetAsync(name: string): Promise<string> {
return `Hello, ${name}!`;
}
}
class InMemoryChannel implements RpcRequestChannel {