diff --git a/config/clients/js/template/client.mustache b/config/clients/js/template/client.mustache index 54fa8cb4..89562c34 100644 --- a/config/clients/js/template/client.mustache +++ b/config/clients/js/template/client.mustache @@ -172,7 +172,7 @@ export type ClientBatchCheckSingleResponse = { } export interface ClientBatchCheckResponse { - responses: ClientBatchCheckSingleResponse[]; + result: ClientBatchCheckSingleResponse[]; } export interface ClientWriteRequestOpts { @@ -750,7 +750,7 @@ export class {{appShortName}}Client extends BaseAPI { } } - return { responses: results }; + return { result: results }; } /** diff --git a/config/clients/js/template/tests/client.test.ts.mustache b/config/clients/js/template/tests/client.test.ts.mustache index afeda694..d80a22aa 100644 --- a/config/clients/js/template/tests/client.test.ts.mustache +++ b/config/clients/js/template/tests/client.test.ts.mustache @@ -574,7 +574,7 @@ describe("{{appTitleCaseName}} Client", () => { const response = await fgaClient.batchCheck({ checks: [], }); - expect(response.responses.length).toBe(0); + expect(response.result.length).toBe(0); }); it("should handle single batch successfully", async () => { const mockedResponse = { @@ -624,9 +624,9 @@ describe("{{appTitleCaseName}} Client", () => { }); expect(scope.isDone()).toBe(true); - expect(response.responses).toHaveLength(2); - expect(response.responses[0].allowed).toBe(true); - expect(response.responses[1].allowed).toBe(false); + expect(response.result).toHaveLength(2); + expect(response.result[0].allowed).toBe(true); + expect(response.result[1].allowed).toBe(false); }); it("should split batches successfully", async () => { const mockedResponse0 = { @@ -698,11 +698,11 @@ describe("{{appTitleCaseName}} Client", () => { expect(scope0.isDone()).toBe(true); expect(scope1.isDone()).toBe(true); - expect(response.responses).toHaveLength(3); + expect(response.result).toHaveLength(3); - const resp0 = response.responses.find(r => r.correlationId === "cor-1"); - const resp1 = response.responses.find(r => r.correlationId === "cor-2"); - const resp2 = response.responses.find(r => r.correlationId === "cor-3"); + const resp0 = response.result.find(r => r.correlationId === "cor-1"); + const resp1 = response.result.find(r => r.correlationId === "cor-2"); + const resp2 = response.result.find(r => r.correlationId === "cor-3"); expect(resp0?.allowed).toBe(true); expect(resp0?.request.user).toBe("user:81684243-9356-4421-8fbf-a4f8d36aa31b");