fis(orchestration): Properly handle select all (#6742)

**What**
Fix select `*` without breaking select none `[]`
This commit is contained in:
Adrien de Peretti
2024-03-20 12:09:54 +00:00
committed by GitHub
parent 05e857d256
commit 06f22bb48a
4 changed files with 62 additions and 21 deletions
@@ -0,0 +1,31 @@
import { RemoteQuery } from "../remote-query"
describe("Remote query", () => {
it("should properly handle fields and relations transformation", () => {
const expand = {
fields: ["name", "age"],
expands: {
friend: {
fields: ["name"],
expands: {
ball: {
fields: ["*"],
},
},
},
},
}
const result = RemoteQuery.getAllFieldsAndRelations(expand)
expect(result).toEqual({
select: ["name", "age", "friend.name"],
relations: ["friend", "friend.ball"],
args: {
"": undefined,
friend: undefined,
"friend.ball": undefined,
},
})
})
})