Created
May 26, 2021 18:36
-
-
Save sergueyarellano/1e9f77082aacbddc977d2c3b921aa27e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test('mapResponse() should map a given body response to the structure desired', async function ({ deepEqual, end }) { | |
const payload = { | |
data: { | |
response: { | |
body: [ | |
{ a: 1, b: 2 }, | |
{ a: 3, b: 4 }, | |
{ a: 5, b: 6 } | |
] | |
} | |
} | |
} | |
const actual = mapResponse(payload) | |
const expected = { | |
data: { | |
mappedResponse: { | |
body: [ | |
{ x: 1, y: 2 }, | |
{ x: 3, y: 4 }, | |
{ x: 5, y: 6 } | |
] | |
}, | |
response: { | |
body: [ | |
{ a: 1, b: 2 }, | |
{ a: 3, b: 4 }, | |
{ a: 5, b: 6 } | |
] | |
} | |
} | |
} | |
deepEqual(actual, expected, 'map every element of the array to given interface') | |
end() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment