feat(orchestration,modules-sdk): options autoCreateServiceNameAlias (#6622)

What:
 Remote joiner options to register service name declared on joiner configs as alias. Default is true, Remote Query in modules-sdk sets it false.
This commit is contained in:
Carlos R. L. Rodrigues
2024-03-07 21:01:30 +00:00
committed by GitHub
parent 43399c8d0d
commit 4625bd1241
4 changed files with 61 additions and 6 deletions
@@ -768,4 +768,38 @@ describe("RemoteJoiner", () => {
},
})
})
it("It shouldn't register the service name as an alias if option autoCreateServiceNameAlias is false", async () => {
const newJoiner = new RemoteJoiner(
serviceConfigs,
fetchServiceDataCallback,
{ autoCreateServiceNameAlias: false }
)
const query = {
service: "user",
fields: ["id", "name", "email"],
}
const data = await newJoiner.query(query)
expect(data).toEqual(
expect.arrayContaining([
{
id: 1,
name: "John Doe",
email: "johndoe@example.com",
},
])
)
const queryWithAlias = {
alias: "user",
fields: ["id", "name", "email"],
}
expect(newJoiner.query(queryWithAlias)).rejects.toThrowError(
`Service with alias "user" was not found.`
)
})
})