This repository has been archived by the owner on Jan 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#30] Rename "problems" to "conditions"
- Loading branch information
1 parent
566a607
commit 68b6457
Showing
18 changed files
with
116 additions
and
121 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
const Boom = require('boom'); | ||
const conditions = require('../agents/conditions'); | ||
|
||
function conditionsDetails(request, reply) { | ||
const conditionId = request.params.id; | ||
|
||
conditions.get(conditionId).then((_condition) => { | ||
reply.view('conditions-details', { | ||
title: _condition.name, | ||
condition: _condition, | ||
}); | ||
}).catch((err) => { | ||
if (err.status === 404) { | ||
reply(Boom.notFound('Condition not found.', err)); | ||
} else { | ||
reply(Boom.badGateway('Error accessing OpenTrials API.', err)); | ||
} | ||
}); | ||
} | ||
|
||
module.exports = conditionsDetails; |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
const conditions = require('../../agents/conditions'); | ||
|
||
describe('Conditions', () => { | ||
describe('#get', () => { | ||
it('returns the condition', () => { | ||
const data = { | ||
id: 1, | ||
name: 'foo', | ||
}; | ||
apiServer.get('/conditions/1').reply(200, data); | ||
return conditions.get(1).should.be.fulfilledWith(data); | ||
}); | ||
|
||
it('rejects if conditionId is inexistent', () => { | ||
apiServer.get('/conditions/1').reply(404); | ||
|
||
return conditions.get(1).should.be.rejectedWith({ | ||
errObj: { status: 404 }, | ||
}); | ||
}); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const uuid = require('node-uuid'); | ||
|
||
function getCondition() { | ||
const condition = { | ||
id: uuid.v1(), | ||
name: 'test condition', | ||
}; | ||
|
||
return condition; | ||
} | ||
|
||
module.exports = getCondition; |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.