fal-js/libs/client/src/function.spec.ts
Daniel Rochetti 07f1b125f7
feat: fal.run url support (#40)
* feat: fal.run url support

* feat: new queue url format

* fix: build issue

* chore: change demo app ids
2024-01-15 15:14:21 -08:00

23 lines
699 B
TypeScript

import uuid from 'uuid-random';
import { buildUrl } from './function';
describe('The function test suite', () => {
it('should build the URL with a function UUIDv4', () => {
const id = uuid();
const url = buildUrl(`12345/${id}`);
expect(url).toMatch(`trigger/12345/${id}`);
});
it('should build the URL with a function user-id-app-alias', () => {
const alias = '12345-some-alias';
const url = buildUrl(alias);
expect(url).toMatch(`fal.run/12345/some-alias`);
});
it('should build the URL with a function username/app-alias', () => {
const alias = 'fal-ai/text-to-image';
const url = buildUrl(alias);
expect(url).toMatch(`fal.run/${alias}`);
});
});