gradio/js/audio/audio.test.ts
Hannah f096c3ae16
Throw helpful error when media devices are not found (#5794)
* add test

* add changeset

* tweak copy

* error logic

* add changeset

* copy tweak

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2023-10-04 20:31:00 +01:00

36 lines
834 B
TypeScript

import { test, describe, assert, afterEach } from "vitest";
import { cleanup, render } from "@gradio/tootils";
import Audio from "./static";
import type { LoadingStatus } from "@gradio/statustracker";
import { setupi18n } from "../app/src/i18n";
const loading_status: LoadingStatus = {
eta: 0,
queue_position: 1,
queue_size: 1,
status: "complete",
scroll_to_output: false,
visible: true,
fn_index: 0,
show_progress: "full"
};
describe("Audio", () => {
setupi18n();
afterEach(() => cleanup());
test("renders audio component", async () => {
const { getAllByTestId } = await render(Audio, {
loading_status,
label: "music",
value: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3",
root: "",
root_url: "",
theme_mode: "dark"
});
assert.exists(getAllByTestId("music-audio"));
});
});