Validate API request query (#4642)
* fix: refactor to accommodate authentication, transaction and pagination together into ctx.state * feat: allow passing response type to APIContext * feat: preliminary work for initial review * fix: use unknown for base types * fix: api/attachments * fix: api/documents * fix: jsdoc comment for input * fix: replace at() with index access for compatibility * fix: validation err message * fix: error handling * fix: remove unnecessary extend
This commit is contained in:
@@ -30,9 +30,7 @@ describe("#documents.info", () => {
|
||||
});
|
||||
const body = await res.json();
|
||||
expect(res.status).toEqual(400);
|
||||
expect(body.message).toEqual(
|
||||
"ValidationError: one of id or shareId is required"
|
||||
);
|
||||
expect(body.message).toEqual("one of id or shareId is required");
|
||||
});
|
||||
|
||||
it("should return published document", async () => {
|
||||
@@ -1824,7 +1822,7 @@ describe("#documents.move", () => {
|
||||
const body = await res.json();
|
||||
expect(res.status).toEqual(400);
|
||||
expect(body.message).toEqual(
|
||||
"ValidationError: infinite loop detected, cannot nest a document inside itself"
|
||||
"infinite loop detected, cannot nest a document inside itself"
|
||||
);
|
||||
});
|
||||
|
||||
@@ -2288,7 +2286,7 @@ describe("#documents.create", () => {
|
||||
|
||||
expect(res.status).toEqual(400);
|
||||
expect(body.message).toBe(
|
||||
"ValidationError: collectionId is required to create a template document"
|
||||
"collectionId is required to create a template document"
|
||||
);
|
||||
});
|
||||
|
||||
@@ -2306,9 +2304,7 @@ describe("#documents.create", () => {
|
||||
const body = await res.json();
|
||||
|
||||
expect(res.status).toEqual(400);
|
||||
expect(body.message).toBe(
|
||||
"ValidationError: collectionId is required to publish"
|
||||
);
|
||||
expect(body.message).toBe("collectionId is required to publish");
|
||||
});
|
||||
|
||||
it("should not allow creating a nested doc without a collection", async () => {
|
||||
@@ -2326,7 +2322,7 @@ describe("#documents.create", () => {
|
||||
|
||||
expect(res.status).toEqual(400);
|
||||
expect(body.message).toBe(
|
||||
"ValidationError: collectionId is required to create a nested document"
|
||||
"collectionId is required to create a nested document"
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user