fixup: test prettier

This commit is contained in:
Valere
2026-04-02 16:53:51 +02:00
parent 6dcb470162
commit 23f846a308
@@ -544,71 +544,68 @@ describe("LocalTransport", () => {
}); });
}); });
it( it("should not update advertised transport on delayID changes, but active should update", async () => {
"should not update advertised transport on delayID changes, but active should update", // For simplicity, we'll just use the config livekit
async () => { customLivekitUrl.setValue("https://lk.example.org");
// For simplicity, we'll just use the config livekit
customLivekitUrl.setValue("https://lk.example.org");
vi.spyOn(openIDSFU, "getSFUConfigWithOpenID").mockResolvedValue( vi.spyOn(openIDSFU, "getSFUConfigWithOpenID").mockResolvedValue(
openIdResponse, openIdResponse,
); );
const delayId$ = new BehaviorSubject<string | null>(null); const delayId$ = new BehaviorSubject<string | null>(null);
const { advertised$, active$ } = createLocalTransport$({ const { advertised$, active$ } = createLocalTransport$({
scope, scope,
ownMembershipIdentity: ownMemberMock, ownMembershipIdentity: ownMemberMock,
roomId: "!example_room_id", roomId: "!example_room_id",
// We want multi-sdu // We want multi-sdu
useOldestMember: false, useOldestMember: false,
forceJwtEndpoint: JwtEndpointVersion.Legacy, forceJwtEndpoint: JwtEndpointVersion.Legacy,
delayId$: delayId$, delayId$: delayId$,
memberships$: constant(new Epoch<CallMembership[]>([])), memberships$: constant(new Epoch<CallMembership[]>([])),
client: { client: {
getDomain: () => "", getDomain: () => "",
baseUrl: "https://example.org", baseUrl: "https://example.org",
// eslint-disable-next-line @typescript-eslint/naming-convention // eslint-disable-next-line @typescript-eslint/naming-convention
_unstable_getRTCTransports: async () => Promise.resolve([]), _unstable_getRTCTransports: async () => Promise.resolve([]),
getAccessToken: vi.fn().mockReturnValue("access_token"), getAccessToken: vi.fn().mockReturnValue("access_token"),
// These won't be called in this error path but satisfy the type // These won't be called in this error path but satisfy the type
getOpenIdToken: vi.fn(), getOpenIdToken: vi.fn(),
getDeviceId: vi.fn(), getDeviceId: vi.fn(),
}, },
}); });
const advertisedValues: LivekitTransportConfig[] = []; const advertisedValues: LivekitTransportConfig[] = [];
const activeValues: LocalTransportWithSFUConfig[] = []; const activeValues: LocalTransportWithSFUConfig[] = [];
advertised$ advertised$
.pipe(filter((v) => v !== null)) .pipe(filter((v) => v !== null))
.subscribe((t) => advertisedValues.push(t)); .subscribe((t) => advertisedValues.push(t));
active$ active$
.pipe(filter((v) => v !== null)) .pipe(filter((v) => v !== null))
.subscribe((t) => activeValues.push(t)); .subscribe((t) => activeValues.push(t));
await flushPromises(); await flushPromises();
// we have now an active and an advertised // we have now an active and an advertised
expect(advertisedValues.length).toEqual(1); expect(advertisedValues.length).toEqual(1);
expect(activeValues.length).toEqual(1); expect(activeValues.length).toEqual(1);
expect(advertisedValues[0]!.livekit_service_url).toEqual( expect(advertisedValues[0]!.livekit_service_url).toEqual(
"https://lk.example.org", "https://lk.example.org",
); );
expect(activeValues[0]!.transport.livekit_service_url).toEqual( expect(activeValues[0]!.transport.livekit_service_url).toEqual(
"https://lk.example.org", "https://lk.example.org",
); );
// Now emits 3 new delays id // Now emits 3 new delays id
delayId$.next("delay_id_1"); delayId$.next("delay_id_1");
await flushPromises(); await flushPromises();
delayId$.next("delay_id_2"); delayId$.next("delay_id_2");
await flushPromises(); await flushPromises();
delayId$.next("delay_id_3"); delayId$.next("delay_id_3");
await flushPromises(); await flushPromises();
// No new emissions should've happened, it is the same transport. only auth and delegation of delay has changed // No new emissions should've happened, it is the same transport. only auth and delegation of delay has changed
expect(advertisedValues.length).toEqual(1); expect(advertisedValues.length).toEqual(1);
expect(activeValues.length).toEqual(4); expect(activeValues.length).toEqual(4);
}, });
);
}); });