fal-js/libs/client/src/function.spec.ts
Daniel Rochetti f075fd914f
feat: support single fal_key env var (#10)
* feat: support single fal_key env var

* fix: default config and tests
2023-09-24 14:21:18 -07:00

19 lines
563 B
TypeScript

import { randomUUID } from 'crypto';
import { getConfig } from './config';
import { buildUrl } from './function';
describe('The function test suite', () => {
it('should build the URL with a function UUIDv4', () => {
const id = randomUUID();
const url = buildUrl(`12345/${id}`);
expect(url).toMatch(`trigger/12345/${id}`);
});
it('should build the URL with a function alias', () => {
const { host } = getConfig();
const alias = '12345-some-alias';
const url = buildUrl(alias);
expect(url).toMatch(`${alias}.${host}`);
});
});