Skip to content

Commit

Permalink
Add actions unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdools-whereby committed Jan 9, 2024
1 parent 0b22d07 commit 8fd816a
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/lib/core/redux/tests/store/rtcAnalytics.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { createStore } from "../store.setup";
import { doRtcAnalyticsCustomEventsInitialize, rtcAnalyticsState } from "../../slices/rtcAnalytics";
import { diff } from "deep-object-diff";

describe("actions", () => {
it("doRtcAnalyticsCustomEventsInitialize", async () => {
const store = createStore({ withRtcManager: true });

const before = store.getState().rtcAnalytics;

store.dispatch(doRtcAnalyticsCustomEventsInitialize());

const after = store.getState().rtcAnalytics;

const updatedState = diff(before, after) as rtcAnalyticsState;

expect(Object.keys(updatedState?.reportedValues)).toEqual(
expect.arrayContaining([
"audioEnabled",
"videoEnabled",
"localScreenshareStream",
"displayName",
"clientId",
"externalId",
"signalConnectionStatus",
"rtcConnectionStatus",
"userRole",
])
);
});
});

0 comments on commit 8fd816a

Please sign in to comment.