Skip to content

Commit

Permalink
Tests: Added Gateway Keyvaluepairs test
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Schwarz authored and maany committed Aug 17, 2023
1 parent f761d33 commit 496455a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ export default class GetDIDKeyValuePairsEndpoint extends BaseEndpoint<DIDKeyValu
return Promise.resolve({ status: 'error', data: [] } as DIDKeyValuePairsDTO) // TODO: add error message
}

createDTO(response : Buffer): DIDKeyValuePairsDTO {
const jsondata = JSON.parse(JSON.parse(response.toString()))
createDTO(response: Object): DIDKeyValuePairsDTO {
const dto: DIDKeyValuePairsDTO = {
status: 'success',
data: Object.entries(jsondata).map(
data: Object.entries(response).map(
([key, value]) => {
return { key: key, value: value } as DIDKeyValuePairs
}
Expand Down
1 change: 1 addition & 0 deletions test/gateway/did/did-gateway-keyvaluepairs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ describe("DID Gateway KeyValuePairs Endpoint Tests", () => {
const dto: DIDKeyValuePairsDTO = await didGateway.getDIDKeyValuePairs(MockRucioServerFactory.VALID_RUCIO_TOKEN, "test", "dataset1")
expect(dto.status).toEqual("success")
expect(dto.data).toContainEqual({key: "extra_key", value: "extra_value"})
expect(dto.data).toContainEqual({key: "scope", value: "test"})
});
})

0 comments on commit 496455a

Please sign in to comment.