test(media): type the media router test client
This commit is contained in:
parent
e601b26292
commit
ffcc47710d
@ -59,13 +59,11 @@ const kit = {
|
||||
},
|
||||
};
|
||||
|
||||
type Client = ReturnType<typeof createRouterClient<ReturnType<typeof createMediaRouter>>>;
|
||||
|
||||
function client(router: ReturnType<typeof createMediaRouter>, actor: Actor | null): Client {
|
||||
function client(router: ReturnType<typeof createMediaRouter>, actor: Actor | null) {
|
||||
return createRouterClient(router, { context: { actor } });
|
||||
}
|
||||
|
||||
function procedure(target: Client, rpcPath: string) {
|
||||
function procedure(target: unknown, rpcPath: string) {
|
||||
let node: unknown = target;
|
||||
for (const key of rpcPath.split("/")) node = (node as Record<string, unknown>)[key];
|
||||
return node as (input: unknown) => Promise<unknown>;
|
||||
@ -104,7 +102,11 @@ describe("media router without a configured sidecar", () => {
|
||||
const capabilities = await client(router, member).capabilities({});
|
||||
expect(capabilities).toEqual(unconfiguredCapabilities());
|
||||
expect(capabilities.configured).toBe(false);
|
||||
expect(Object.values(capabilities.operations).every((op) => !op.available)).toBe(true);
|
||||
expect(
|
||||
Object.values(capabilities.operations).every(
|
||||
(op) => !(op as { available: boolean }).available,
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("refuses every other procedure", async () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user