fal-js/libs/client/src/runtime.spec.ts
Daniel Rochetti c3a3c3d21a
chore: upgrade dependencies and tooling (#81)
* chore: remove uuid-random dependency

* chore: upgrade prettier

* chore(client): bump version for release
2024-08-07 15:45:15 -07:00

20 lines
602 B
TypeScript

import { getUserAgent, isBrowser } from "./runtime";
describe("the runtime test suite", () => {
it("should return false when calling isBrowser() on a test", () => {
expect(isBrowser()).toBe(false);
});
it("should return true when calling isBrowser() and window is present", () => {
global.window = {
document: {},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any;
expect(isBrowser()).toBe(true);
});
it("should create the correct user agent identifier", () => {
expect(getUserAgent()).toMatch(/@fal-ai\/serverless-client/);
});
});