Files
windmill/cli/test/trigger_templates_unit.test.ts
T
Alexander PetricandClaude Opus 5.5 65f3c5ee5c fix(cli): flow preview hub steps and windmill paths, trigger templates (#12075)
* fix(cli): drop deprecated and unused fields from trigger new templates

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): flow preview takes the windmill path and runs hub steps with --step

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): run a deployed script step with its deployed lock in flow preview --step

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): flow preview --remote honors nonDottedPaths when resolving the folder

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:22:50 +01:00

45 lines
1.5 KiB
TypeScript

/**
* `wmill trigger new` scaffolds only fields the backend reads: `request_type`
* rather than the deprecated `is_async`, no `requires_auth` (its column was
* renamed to `authentication_method`), and `mode` rather than the deprecated
* `enabled`.
*/
import { expect, test, describe } from "bun:test";
import { triggerTemplates } from "../src/commands/trigger/trigger.ts";
describe("trigger new templates", () => {
test("the http template has no is_async or requires_auth", () => {
const http = triggerTemplates.http;
expect(Object.keys(http)).not.toContain("is_async");
expect(Object.keys(http)).not.toContain("requires_auth");
expect(http.request_type).toBe("sync");
expect(http.authentication_method).toBe("none");
});
test("no template scaffolds the deprecated enabled field", () => {
const withEnabled = Object.entries(triggerTemplates)
.filter(([, template]) => "enabled" in template)
.map(([kind]) => kind);
expect(withEnabled).toEqual([]);
});
test("templates that scaffolded a disabled trigger still do, through mode", () => {
const modes = Object.fromEntries(
Object.entries(triggerTemplates).map(([kind, t]) => [kind, t.mode]),
);
expect(modes).toEqual({
http: undefined,
websocket: "disabled",
kafka: "disabled",
nats: "disabled",
postgres: "disabled",
mqtt: "disabled",
amqp: "disabled",
sqs: "disabled",
gcp: "disabled",
azure: "disabled",
email: "disabled",
});
});
});