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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user