diff --git a/src/useAudioContext.test.tsx b/src/useAudioContext.test.tsx
index f2e2efdb..814df8e9 100644
--- a/src/useAudioContext.test.tsx
+++ b/src/useAudioContext.test.tsx
@@ -9,6 +9,7 @@ import { expect, vi, afterEach, beforeEach, test } from "vitest";
import { type FC } from "react";
import { render } from "@testing-library/react";
import userEvent, { type UserEvent } from "@testing-library/user-event";
+import { BrowserRouter } from "react-router-dom";
import { deviceStub, MediaDevicesContext } from "./livekit/MediaDevicesContext";
import { useAudioContext } from "./useAudioContext";
@@ -38,6 +39,13 @@ const TestComponent: FC = () => {
>
);
};
+const TestComponentWrapper: FC = () => {
+ return (
+
+
+
+ );
+};
const gainNode = vi.mocked(
{
@@ -94,13 +102,13 @@ afterEach(() => {
});
test("can play a single sound", async () => {
- const { findByText } = render();
+ const { findByText } = render();
await user.click(await findByText("Valid sound"));
expect(testAudioContext.createBufferSource).toHaveBeenCalledOnce();
});
test("will ignore sounds that are not registered", async () => {
- const { findByText } = render();
+ const { findByText } = render();
await user.click(await findByText("Invalid sound"));
expect(testAudioContext.createBufferSource).not.toHaveBeenCalled();
});
@@ -122,7 +130,7 @@ test("will use the correct device", () => {
stopUsingDeviceNames: () => {},
}}
>
-
+
,
);
expect(testAudioContext.createBufferSource).not.toHaveBeenCalled();
@@ -131,7 +139,7 @@ test("will use the correct device", () => {
test("will use the correct volume level", async () => {
soundEffectVolumeSetting.setValue(0.33);
- const { findByText } = render();
+ const { findByText } = render();
await user.click(await findByText("Valid sound"));
expect(testAudioContext.gain.gain.setValueAtTime).toHaveBeenCalledWith(
0.33,
@@ -157,7 +165,7 @@ test("will use the pan if earpiece is selected", async () => {
stopUsingDeviceNames: () => {},
}}
>
-
+
,
);
await user.click(await findByText("Valid sound"));