Skip to content

Instantly share code, notes, and snippets.

@sergueyarellano
Created May 26, 2021 18:32
Show Gist options
  • Save sergueyarellano/e5de23a14cf2376113f706821c415faf to your computer and use it in GitHub Desktop.
Save sergueyarellano/e5de23a14cf2376113f706821c415faf to your computer and use it in GitHub Desktop.
test('composeRequest() should compose request options so they can be consumed by the GOT http customer module ', async function ({ deepEqual, end }) {
const config = {
endpoint: 'foo',
host: 'http://localhost:3333',
method: 'GET',
headers: { 'content-type': 'application/json' }
}
// composeRequest :: Payload -> Payload
const actual = composeRequest(deepFreeze(lift(config)))
const expected = {
event: { body: {} },
data: {
config,
request: {
uri: new URL('foo', 'http://localhost:3333'),
options: {
method: 'GET',
headers: { 'content-type': 'application/json' }
}
}
},
result: {}
}
deepEqual(actual, expected)
end()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment