Skip to content
This repository has been archived by the owner on Apr 30, 2022. It is now read-only.

Commit

Permalink
Merge 22fda11 into 1c980bb
Browse files Browse the repository at this point in the history
  • Loading branch information
evaporei committed Jan 1, 2018
2 parents 1c980bb + 22fda11 commit dcfd0a9
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 17 deletions.
4 changes: 2 additions & 2 deletions test/functional/request/createLanguidReq.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test('createLanguidReq', t => {

const languidReq = createLanguidReq(httpReqMock)

const expectLanguidReq = {
const expectedLanguidReq = {
body: {
content: 'stuff',
},
Expand All @@ -46,5 +46,5 @@ test('createLanguidReq', t => {
url: '/bla?name=john',
}

t.deepEqual(languidReq, expectLanguidReq, 'wrong content')
t.deepEqual(languidReq, expectedLanguidReq, 'wrong content')
})
18 changes: 9 additions & 9 deletions test/integration/v1.0.3.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ test('v1.0.3', t => {
resolveWithFullResponse: true,
}

const expectHeaders = {
const expectedHeaders = {
stuff: 'content',
}

const expectBody = JSON.stringify({
const expectedBody = JSON.stringify({
ok: 'ok'
})

Expand All @@ -23,7 +23,7 @@ test('v1.0.3', t => {
t.is(res.headers['content-type'], 'application/json', 'wrong headers')
t.is(res.headers['x-powered-by'], 'languid', 'wrong headers')
t.is(res.headers.stuff, 'content', 'wrong headers')
t.is(res.body, expectBody, 'wrong body')
t.is(res.body, expectedBody, 'wrong body')
})
.catch(t.fail)
})
Expand All @@ -39,9 +39,9 @@ test('v1.0.3', t => {
json: true,
}

const expectHeaders = {}
const expectedHeaders = {}

const expectBody = {
const expectedBody = {
message: 'Internal Server Error',
}

Expand All @@ -51,7 +51,7 @@ test('v1.0.3', t => {
t.is(res.statusCode, 500, 'wrong statusCode')
t.is(res.headers['content-type'], 'application/json', 'wrong headers')
t.is(res.headers['x-powered-by'], 'languid', 'wrong headers')
t.deepEqual(res.body, expectBody, 'wrong body')
t.deepEqual(res.body, expectedBody, 'wrong body')
})
})

Expand All @@ -66,9 +66,9 @@ test('v1.0.3', t => {
json: true,
}

const expectHeaders = {}
const expectedHeaders = {}

const expectBody = {
const expectedBody = {
got: 'bla'
}

Expand All @@ -78,6 +78,6 @@ test('v1.0.3', t => {
t.is(res.statusCode, 404, 'wrong statusCode')
t.is(res.headers['content-type'], 'application/json', 'wrong headers')
t.is(res.headers['x-powered-by'], 'languid', 'wrong headers')
t.deepEqual(res.body, expectBody, 'wrong body')
t.deepEqual(res.body, expectedBody, 'wrong body')
})
})
8 changes: 4 additions & 4 deletions test/unit/response/responseBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test('responseBuilder', t => {

const response = responseBuilder(languidResMock)

const expectResponse = {
const expectedResponse = {
statusCode: 500,
headers: {
a: 'header',
Expand All @@ -26,15 +26,15 @@ test('responseBuilder', t => {
}),
}

t.deepEqual(response, expectResponse, 'wrong content')
t.deepEqual(response, expectedResponse, 'wrong content')
})

test('responseBuilder', t => {
const languidResMock = {}

const response = responseBuilder(languidResMock)

const expectResponse = {
const expectedResponse = {
statusCode: undefined,
headers: {
'Content-Type': 'application/json',
Expand All @@ -43,5 +43,5 @@ test('responseBuilder', t => {
body: JSON.stringify({}),
}

t.deepEqual(response, expectResponse, 'wrong content')
t.deepEqual(response, expectedResponse, 'wrong content')
})
4 changes: 2 additions & 2 deletions test/unit/routes_handlers/executeHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ test('executeHandler', t => {

const response = executeHandler(languidReqMock)(route.handler)

const expectResponse = {
const expectedResponse = {
statusCode: 204,
body: {
stuff: 'content',
},
}

t.is(handlerCalls, 1, 'wrong number of `handler` calls')
t.deepEqual(response, expectResponse, 'wrong response content')
t.deepEqual(response, expectedResponse, 'wrong response content')
})
16 changes: 16 additions & 0 deletions test/unit/utils/bufferArrayToObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,19 @@ test('bufferArrayToObject', t => {
'wrong content'
)
})

test('bufferArrayToObject', t => {
const dataString = ''

const bufferArray = [Buffer(dataString)]

t.is(typeof bufferArrayToObject(bufferArray), 'object', 'wrong type')

const expectedObject = {}

t.deepEqual(
bufferArrayToObject(bufferArray),
expectedObject,
'wrong content'
)
})

0 comments on commit dcfd0a9

Please sign in to comment.