From: Lucas Di Pentima Date: Fri, 16 Aug 2019 14:22:38 +0000 (-0300) Subject: 15407: Tests that only first level keys are mapped on resource objects. X-Git-Tag: 2.0.0~40^2~10 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/9cc1b7cb37e9f70103b7fce3a8548f699724c18d 15407: Tests that only first level keys are mapped on resource objects. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/src/services/common-service/common-resource-service.test.ts b/src/services/common-service/common-resource-service.test.ts index 5a3bae25..a6a8b9d0 100644 --- a/src/services/common-service/common-resource-service.test.ts +++ b/src/services/common-service/common-resource-service.test.ts @@ -60,11 +60,22 @@ describe("CommonResourceService", () => { it("#get", async () => { axiosMock .onGet("/resource/uuid") - .reply(200, { modified_at: "now" }); + .reply(200, { + modified_at: "now", + properties: { + responsible_owner_uuid: "another_owner" + } + }); const commonResourceService = new CommonResourceService(axiosInstance, "resource", actions); const resource = await commonResourceService.get("uuid"); - expect(resource).toEqual({ modifiedAt: "now" }); + // Only first level keys are mapped to camel case + expect(resource).toEqual({ + modifiedAt: "now", + properties: { + responsible_owner_uuid: "another_owner" + } + }); }); it("#list", async () => { @@ -75,19 +86,26 @@ describe("CommonResourceService", () => { offset: 2, limit: 10, items: [{ - modified_at: "now" + modified_at: "now", + properties: { + is_active: true + } }], items_available: 20 }); const commonResourceService = new CommonResourceService(axiosInstance, "resource", actions); const resource = await commonResourceService.list({ limit: 10, offset: 1 }); + // First level keys are mapped to camel case inside "items" arrays expect(resource).toEqual({ kind: "kind", offset: 2, limit: 10, items: [{ - modifiedAt: "now" + modifiedAt: "now", + properties: { + is_active: true + } }], itemsAvailable: 20 });