export RepoQueryIn from client

This commit is contained in:
dswbx
2025-02-18 12:54:13 +01:00
parent dec382b49d
commit 7994eabe7d
4 changed files with 62 additions and 3 deletions

View File

@@ -70,4 +70,34 @@ describe("repros", async () => {
expect(app.em.entities.map((e) => e.name)).toEqual(["media", "test"]);
});
test.only("verify inversedBy", async () => {
const schema = proto.em(
{
products: proto.entity("products", {
title: proto.text()
}),
product_likes: proto.entity("product_likes", {
created_at: proto.date()
}),
users: proto.entity("users", {})
},
(fns, schema) => {
fns.relation(schema.product_likes).manyToOne(schema.products, { inversedBy: "likes" });
fns.relation(schema.product_likes).manyToOne(schema.users);
}
);
const app = createApp({ initialConfig: { data: schema.toJSON() } });
await app.build();
const info = (await (await app.server.request("/api/data/info/products")).json()) as any;
expect(info.fields).toEqual(["id", "title"]);
expect(info.relations.listable).toEqual([
{
entity: "product_likes",
ref: "likes"
}
]);
});
});