fal-js/libs/client/src/runtime.spec.ts
Daniel Rochetti ed322048ff
release: client 0.1.0 (#6)
* chore(client): add assets and bump version
* chore: rename scope to fal-ai
2023-03-31 18:35:08 -03: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/);
});
});