commit d4c0f82d9c0f39acb7b4eff9c904b593e8a7f47e
parent a02053a8267d781e02fa16bbcdf3d649c046efaa
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 13 Nov 2026 15:29:13 -0500
persist-videos route test: below-height is accepted and answers its buckets
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/editor/app/api/ops/persist-videos/route.test.ts b/editor/app/api/ops/persist-videos/route.test.ts
@@ -21,7 +21,10 @@ const items = [
];
type Bucket = { count: number; items: { slug: string; id: string }[] };
-type Plan = Record<"saved" | "wrongHeight" | "toFetch" | "noUrl" | "unknown", Bucket> & {
+type Plan = Record<
+ "saved" | "wrongHeight" | "lowerHeight" | "heightUnknown" | "toFetch" | "noUrl" | "unknown",
+ Bucket
+> & {
willFetch: number;
};
@@ -35,6 +38,15 @@ test("persist-videos buckets a list in a dry run, and refuses a bad body and a l
assert.equal(plan.saved.count, 0);
assert.equal(plan.willFetch, 1);
+ // "below-height" is accepted and answers its two buckets; nothing here is
+ // saved, so they are empty.
+ const upgrade = await callPost(POST, { items, format: "original", replace: "below-height", dryRun: true });
+ assert.equal(upgrade.status, 200, JSON.stringify(upgrade.body));
+ const upPlan = upgrade.body.plan as Plan;
+ assert.deepEqual(upPlan.lowerHeight, { count: 0, items: [] });
+ assert.deepEqual(upPlan.heightUnknown, { count: 0, items: [] });
+ assert.equal(upPlan.willFetch, 1);
+
// Nothing to fetch is an answer, not a job.
const none = await callPost(POST, { items: [{ slug: "no-such-channel", id: "abc123" }] });
assert.equal(none.status, 200, JSON.stringify(none.body));
@@ -47,7 +59,7 @@ test("persist-videos buckets a list in a dry run, and refuses a bad body and a l
[{ items: [{ slug, id: video, height: 720 }] }, /unknown key\(s\): height/],
[{ items: [{ slug, id: "../escape" }] }, /is not a video id/],
[{ items, format: "1080p" }, /"format" must be one of original, video_720/],
- [{ items, replace: "always" }, /"replace" must be one of never, above-height/],
+ [{ items, replace: "always" }, /"replace" must be one of never, above-height, below-height/],
[{ items, gapMs: -1 }, /"gapMs" must be a whole number, zero or above/],
[{ items, minFreeMemMb: "4096" }, /"minFreeMemMb" must be a whole number/],
[{ items, dryRun: "yes" }, /"dryRun" must be a boolean/],