Consolidate yes/no marbles into one definition
This commit is contained in:
@@ -94,6 +94,11 @@ vi.mock("rxjs", async (importOriginal) => ({
|
|||||||
|
|
||||||
vi.mock("@livekit/components-core");
|
vi.mock("@livekit/components-core");
|
||||||
|
|
||||||
|
const yesNo = {
|
||||||
|
y: true,
|
||||||
|
n: false,
|
||||||
|
};
|
||||||
|
|
||||||
const daveRtcMember = mockRtcMembership("@dave:example.org", "DDDD");
|
const daveRtcMember = mockRtcMembership("@dave:example.org", "DDDD");
|
||||||
|
|
||||||
const carol = local;
|
const carol = local;
|
||||||
@@ -416,10 +421,7 @@ test("screen sharing activates spotlight layout", () => {
|
|||||||
);
|
);
|
||||||
expectObservable(vm.showSpeakingIndicators$).toBe(
|
expectObservable(vm.showSpeakingIndicators$).toBe(
|
||||||
expectedShowSpeakingMarbles,
|
expectedShowSpeakingMarbles,
|
||||||
{
|
yesNo,
|
||||||
y: true,
|
|
||||||
n: false,
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -444,18 +446,9 @@ test("participants stay in the same order unless to appear/disappear", () => {
|
|||||||
constant([localRtcMember, aliceRtcMember, bobRtcMember, daveRtcMember]),
|
constant([localRtcMember, aliceRtcMember, bobRtcMember, daveRtcMember]),
|
||||||
of(ConnectionState.Connected),
|
of(ConnectionState.Connected),
|
||||||
new Map([
|
new Map([
|
||||||
[
|
[aliceParticipant, behavior(aSpeakingInputMarbles, yesNo)],
|
||||||
aliceParticipant,
|
[bobParticipant, behavior(bSpeakingInputMarbles, yesNo)],
|
||||||
behavior(aSpeakingInputMarbles, { y: true, n: false }),
|
[daveParticipant, behavior(dSpeakingInputMarbles, yesNo)],
|
||||||
],
|
|
||||||
[
|
|
||||||
bobParticipant,
|
|
||||||
behavior(bSpeakingInputMarbles, { y: true, n: false }),
|
|
||||||
],
|
|
||||||
[
|
|
||||||
daveParticipant,
|
|
||||||
behavior(dSpeakingInputMarbles, { y: true, n: false }),
|
|
||||||
],
|
|
||||||
]),
|
]),
|
||||||
mockMediaDevices({}),
|
mockMediaDevices({}),
|
||||||
(vm) => {
|
(vm) => {
|
||||||
@@ -511,14 +504,8 @@ test("participants adjust order when space becomes constrained", () => {
|
|||||||
constant([localRtcMember, aliceRtcMember, bobRtcMember, daveRtcMember]),
|
constant([localRtcMember, aliceRtcMember, bobRtcMember, daveRtcMember]),
|
||||||
of(ConnectionState.Connected),
|
of(ConnectionState.Connected),
|
||||||
new Map([
|
new Map([
|
||||||
[
|
[bobParticipant, behavior(bSpeakingInputMarbles, yesNo)],
|
||||||
bobParticipant,
|
[daveParticipant, behavior(dSpeakingInputMarbles, yesNo)],
|
||||||
behavior(bSpeakingInputMarbles, { y: true, n: false }),
|
|
||||||
],
|
|
||||||
[
|
|
||||||
daveParticipant,
|
|
||||||
behavior(dSpeakingInputMarbles, { y: true, n: false }),
|
|
||||||
],
|
|
||||||
]),
|
]),
|
||||||
mockMediaDevices({}),
|
mockMediaDevices({}),
|
||||||
(vm) => {
|
(vm) => {
|
||||||
@@ -570,18 +557,9 @@ test("spotlight speakers swap places", () => {
|
|||||||
constant([localRtcMember, aliceRtcMember, bobRtcMember, daveRtcMember]),
|
constant([localRtcMember, aliceRtcMember, bobRtcMember, daveRtcMember]),
|
||||||
of(ConnectionState.Connected),
|
of(ConnectionState.Connected),
|
||||||
new Map([
|
new Map([
|
||||||
[
|
[aliceParticipant, behavior(aSpeakingInputMarbles, yesNo)],
|
||||||
aliceParticipant,
|
[bobParticipant, behavior(bSpeakingInputMarbles, yesNo)],
|
||||||
behavior(aSpeakingInputMarbles, { y: true, n: false }),
|
[daveParticipant, behavior(dSpeakingInputMarbles, yesNo)],
|
||||||
],
|
|
||||||
[
|
|
||||||
bobParticipant,
|
|
||||||
behavior(bSpeakingInputMarbles, { y: true, n: false }),
|
|
||||||
],
|
|
||||||
[
|
|
||||||
daveParticipant,
|
|
||||||
behavior(dSpeakingInputMarbles, { y: true, n: false }),
|
|
||||||
],
|
|
||||||
]),
|
]),
|
||||||
mockMediaDevices({}),
|
mockMediaDevices({}),
|
||||||
(vm) => {
|
(vm) => {
|
||||||
@@ -1246,10 +1224,10 @@ test("audio output changes when toggling earpiece mode", () => {
|
|||||||
schedule(toggleInputMarbles, {
|
schedule(toggleInputMarbles, {
|
||||||
a: () => getValue(vm.audioOutputSwitcher$)?.switch(),
|
a: () => getValue(vm.audioOutputSwitcher$)?.switch(),
|
||||||
});
|
});
|
||||||
expectObservable(vm.earpieceMode$).toBe(expectedEarpieceModeMarbles, {
|
expectObservable(vm.earpieceMode$).toBe(
|
||||||
n: false,
|
expectedEarpieceModeMarbles,
|
||||||
y: true,
|
yesNo,
|
||||||
});
|
);
|
||||||
expectObservable(
|
expectObservable(
|
||||||
vm.audioOutputSwitcher$.pipe(
|
vm.audioOutputSwitcher$.pipe(
|
||||||
map((switcher) => switcher?.targetOutput),
|
map((switcher) => switcher?.targetOutput),
|
||||||
|
|||||||
Reference in New Issue
Block a user