Created
May 28, 2021 17:07
-
-
Save sergueyarellano/03a26acb318db20f71399ea51d6bfa8e 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
{ | |
data, | |
metadata | |
} | |
test('createResult() should produce a formatted structure to use as response', async function ({ deepEqual, end }) { | |
const payload = { | |
data: { | |
mappedResponse: [ | |
{ 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 } | |
] | |
} | |
} | |
} | |
const actual = createResult(deepFreeze(payload)) | |
const expected = { | |
data: { | |
mappedResponse: [ | |
{ 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 } | |
] | |
} | |
}, | |
result: { | |
data: [ | |
{ x: 1, y: 2 }, | |
{ x: 3, y: 4 }, | |
{ x: 5, y: 6 } | |
], | |
metadata: {} | |
} | |
} | |
deepEqual(actual, expected, 'copy mappedResponse to result field and apply contract') | |
end() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment