Spaces:
Paused
Paused
Download node_modules/@gradio/client/src/test/view_api.test.ts from Leon4gr45/UserSyncFrontend: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40gradio/client/src/test/view_api.test.ts
- Command line
-
hf download hf://spaces/Leon4gr45/UserSyncFrontend/node_modules/@gradio/client/src/test/view_api.test.ts
-
curl -L -o view_api.test.ts https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40gradio/client/src/test/view_api.test.ts
1.46 kB
| import { describe, beforeAll, afterEach, afterAll, test, expect } from "vitest"; | |
| import { Client, client, duplicate } from ".."; | |
| import { transformed_api_info, config_response } from "./test_data"; | |
| import { initialise_server } from "./server"; | |
| const app_reference = "hmb/hello_world"; | |
| const secret_app_reference = "hmb/secret_world"; | |
| const secret_direct_app_reference = "https://hmb-secret-world.hf.space"; | |
| const server = initialise_server(); | |
| beforeAll(() => server.listen()); | |
| afterEach(() => server.resetHandlers()); | |
| afterAll(() => server.close()); | |
| describe("view_api", () => { | |
| test("viewing the api of a running, public app", async () => { | |
| const app = await Client.connect(app_reference); | |
| expect(await app.view_api()).toEqual(transformed_api_info); | |
| }); | |
| test("viewing the api of a running, private app", async () => { | |
| const app = await Client.connect(secret_app_reference, { | |
| token: "hf_123" | |
| }); | |
| expect(app.config).toEqual({ | |
| ...config_response, | |
| root: secret_direct_app_reference | |
| }); | |
| expect(await app.view_api()).toEqual({ | |
| ...transformed_api_info | |
| }); | |
| }); | |
| test("viewing the api of a running, private app with a direct app URL", async () => { | |
| const app = await Client.connect(secret_direct_app_reference, { | |
| token: "hf_123" | |
| }); | |
| expect(app.config).toEqual({ | |
| ...config_response, | |
| root: secret_direct_app_reference | |
| }); | |
| expect(await app.view_api()).toEqual({ | |
| ...transformed_api_info | |
| }); | |
| }); | |
| }); | |