Files
windmill/cli/test/pipeline_partition_unit.test.ts
Ruben Fiszel d65f58c388 fix: pipeline dogfooding fixes — SCD2 data-test scope, --partition, s3object upload binding (#9875)
* fix: scope SCD2 built-in data tests to current rows

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat: add --partition to pipeline run and fix duckdb s3object upload binding

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* docs: note filesystem storage type is dev-only in storage settings

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix: use ISO week for weekly partition default in pipeline run

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 12:04:54 +02:00

24 lines
1.3 KiB
TypeScript

import { expect, test } from "bun:test";
import { defaultPartitionValue } from "../src/commands/pipeline/pipeline.ts";
// Mirrors the backend defaults in partition_ee.rs::default_format — a --local
// run resolves the partition client-side, so a divergence here writes a slice
// the deployed cadence never reruns.
test("defaultPartitionValue: time kinds match backend default formats (UTC)", () => {
const at = new Date(Date.UTC(2026, 6, 2, 6, 30)); // 2026-07-02T06:30Z, a Thursday
expect(defaultPartitionValue("daily", at)).toBe("2026-07-02");
expect(defaultPartitionValue("hourly", at)).toBe("2026-07-02T06");
expect(defaultPartitionValue("weekly", at)).toBe("2026-W27");
expect(defaultPartitionValue("monthly", at)).toBe("2026-07");
expect(defaultPartitionValue("dynamic", at)).toBeUndefined();
});
test("defaultPartitionValue: ISO week-year boundaries (%G-W%V)", () => {
// Jan 1 2026 is a Thursday → week 1 of 2026.
expect(defaultPartitionValue("weekly", new Date(Date.UTC(2026, 0, 1)))).toBe("2026-W01");
// Jan 1 2023 is a Sunday → still week 52 of 2022.
expect(defaultPartitionValue("weekly", new Date(Date.UTC(2023, 0, 1)))).toBe("2022-W52");
// Dec 30 2024 is a Monday → already week 1 of 2025.
expect(defaultPartitionValue("weekly", new Date(Date.UTC(2024, 11, 30)))).toBe("2025-W01");
});