Skip to content

Fixtures

Loads the committed demo fixtures and decodes a recorded response into the value apiFetch would return (a JSON value, text, or Blob).

Interfaces

Fixture

Defined in: src/demo/api/fixtures.ts:12

A recorded apiFetch response.

Properties

Property Type Description Defined in
body unknown A JSON value, or a string for text / SVG bodies. src/demo/api/fixtures.ts:16
contentType string - src/demo/api/fixtures.ts:14
status number - src/demo/api/fixtures.ts:13

Functions

decodeFixture()

function decodeFixture(fx): unknown;

Defined in: src/demo/api/fixtures.ts:39

Decodes a fixture into the value apiFetch returns for its content type.

Parameters

Parameter Type
fx Fixture

Returns

unknown


jobResult()

function jobResult(type): unknown;

Defined in: src/demo/api/fixtures.ts:34

The canned terminal result for a job type (generate_srt, transcribe, ...).

Parameters

Parameter Type
type string

Returns

unknown


lookupFixture()

function lookupFixture(method, url, body?): Fixture | undefined;

Defined in: src/demo/api/fixtures.ts:24

Looks up a recorded response by request key.

Parameters

Parameter Type
method string
url string
body? unknown

Returns

Fixture | undefined


lookupStream()

function lookupStream(url, body?): string | undefined;

Defined in: src/demo/api/fixtures.ts:29

Looks up a recorded SSE stream (the raw response body text) by request key.

Parameters

Parameter Type
url string
body? unknown

Returns

string | undefined