mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-02 08:06:00 +00:00
ca55503e66
* refactored core and core/utils imports * refactored core and core/utils imports * refactored media imports * refactored auth imports * refactored data imports * updated package json exports, fixed mm config * fix tests
55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { Task } from "../../src/flows";
|
|
import { dynamic } from "../../src/flows/tasks/Task";
|
|
import { s } from "core/utils/schema";
|
|
|
|
describe.skip("Task", async () => {
|
|
test("resolveParams: template with parse", async () => {
|
|
const result = await Task.resolveParams(
|
|
s.object({ test: dynamic(s.number()) }),
|
|
{
|
|
test: "{{ some.path }}",
|
|
},
|
|
{
|
|
some: {
|
|
path: 1,
|
|
},
|
|
},
|
|
);
|
|
|
|
expect(result.test).toBe(1);
|
|
});
|
|
|
|
test("resolveParams: with string", async () => {
|
|
const result = await Task.resolveParams(
|
|
s.object({ test: s.string() }),
|
|
{
|
|
test: "{{ some.path }}",
|
|
},
|
|
{
|
|
some: {
|
|
path: "1/1",
|
|
},
|
|
},
|
|
);
|
|
|
|
expect(result.test).toBe("1/1");
|
|
});
|
|
|
|
test("resolveParams: with object", async () => {
|
|
const result = await Task.resolveParams(
|
|
s.object({ test: dynamic(s.object({ key: s.string(), value: s.string() })) }),
|
|
{
|
|
test: { key: "path", value: "{{ some.path }}" },
|
|
},
|
|
{
|
|
some: {
|
|
path: "1/1",
|
|
},
|
|
},
|
|
);
|
|
|
|
expect(result.test).toEqual({ key: "path", value: "1/1" });
|
|
});
|
|
});
|