prefixed data entity endpoints with /entity

This commit is contained in:
dswbx
2025-02-18 09:12:12 +01:00
parent bd362607ae
commit 3e6d381239
14 changed files with 147 additions and 73 deletions

View File

@@ -17,11 +17,11 @@ describe("DataApi", () => {
const get = api.readMany("a".repeat(300), { select: ["id", "name"] });
expect(get.request.method).toBe("GET");
expect(new URL(get.request.url).pathname).toBe(`/api/data/${"a".repeat(300)}`);
expect(new URL(get.request.url).pathname).toBe(`/api/data/entity/${"a".repeat(300)}`);
const post = api.readMany("a".repeat(1000), { select: ["id", "name"] });
expect(post.request.method).toBe("POST");
expect(new URL(post.request.url).pathname).toBe(`/api/data/${"a".repeat(1000)}/query`);
expect(new URL(post.request.url).pathname).toBe(`/api/data/entity/${"a".repeat(1000)}/query`);
});
it("returns result", async () => {
@@ -39,7 +39,7 @@ describe("DataApi", () => {
const app = controller.getController();
{
const res = (await app.request("/posts")) as Response;
const res = (await app.request("/entity/posts")) as Response;
const { data } = await res.json();
expect(data.length).toEqual(3);
}