Skip to content

Build your personal knowledge base with Trilium Notes

test(server): check plain-text tuple results on a route that still has one

Elian Doran3d61550f327a
diff --git a/apps/server/src/routes/transport.spec.ts b/apps/server/src/routes/transport.spec.ts
index 12aeb6b31f..51397cec2c 100644
--- a/apps/server/src/routes/transport.spec.ts
+++ b/apps/server/src/routes/transport.spec.ts
@@ -103,12 +103,14 @@ describe("Route transport & middleware", () => {
});
it("serves a [statusCode, string] handler result as plain text", async () => {
- // /api/login/token returns [401, "Incorrect credential"] on a bad
- // password — exercising apiResultHandler's array form and send()'s
- // text-error branch.
- const res = await supertest(app).post("/api/login/token").send({ password: "wrong" }).expect(401);
+ // /api/onenote-import/device-poll returns [400, "No sign-in is in progress."] on a
+ // session without a pending sign-in — exercising apiResultHandler's array form and
+ // send()'s text-error branch.
+ const res = await ctx.agent.post("/api/onenote-import/device-poll")
+ .set("x-csrf-token", ctx.csrfToken)
+ .expect(400);
expect(res.headers["content-type"]).toContain("text/plain");
- expect(res.text).toBe("Incorrect credential");
+ expect(res.text).toBe("No sign-in is in progress.");
});
it("maps a thrown ValidationError to a 400 JSON body", async () => {