fix(clip): a clip refusal speaks the user's language, and a choice in the clip form no longer sends it
The backend refuses a clip with a structured reason, but the client showed every one as the generic "couldn't make the clip": each reason now has its own message in both languages, held to the backend's reasons in both directions by the contract test. A segmented toggle's and the priority stepper's buttons had no type, so inside a form one of them submitted it.
This commit is contained in:
@@ -245,6 +245,22 @@ describe("req — a structured refusal reads in the user's language", () => {
|
||||
expect(err.detail).toBeUndefined();
|
||||
});
|
||||
|
||||
it.each([
|
||||
["too_long", "clip.errors.too_long"],
|
||||
["bad_crop", "clip.errors.bad_crop"],
|
||||
])("says why a clip was not cut (%s)", async (reason, localized) => {
|
||||
// It read as the generic "couldn't carry out that action" — a 10-minute cap no retry gets past.
|
||||
vi.spyOn(globalThis, "fetch").mockResolvedValue(
|
||||
new Response(JSON.stringify({ detail: { code: "clip", reason } }), {
|
||||
status: 422,
|
||||
headers: { "content-type": "application/json" },
|
||||
}),
|
||||
);
|
||||
await expect(
|
||||
req("/api/downloads/clip", { method: "POST" }, { quiet: true }),
|
||||
).rejects.toMatchObject({ detail: localized });
|
||||
});
|
||||
|
||||
it.each(["quota", "reconnect", "unavailable"])(
|
||||
"says what to do about an action YouTube refused (%s)",
|
||||
async (reason) => {
|
||||
|
||||
Reference in New Issue
Block a user