Fixing mock-http for double digit ids

This commit is contained in:
Matthew Dillon 2015-03-19 11:04:04 -08:00
parent c68f0a0fee
commit 38a382279a
2 changed files with 6 additions and 6 deletions

View file

@ -105,7 +105,7 @@ module.exports = function(app) {
id: 8, id: 8,
strain: 2, strain: 2,
characteristic: 'Characteristic 3', characteristic: 'Characteristic 3',
textMeasurementType: 'Meas. Type 1', textMeasurementType: null,
txtValue: "text value", txtValue: "text value",
numValue: null, numValue: null,
confidenceInterval: null, confidenceInterval: null,
@ -157,16 +157,16 @@ module.exports = function(app) {
measurementsRouter.get('/:id', function(req, res) { measurementsRouter.get('/:id', function(req, res) {
var measurements = MEASUREMENTS.filter(function(m) { var measurements = MEASUREMENTS.filter(function(m) {
return req.params.id.indexOf(m.id.toString()) > -1; return m.id == req.params.id;
}); });
res.send({ res.send({
'measurement': measurements[0] 'measurement': measurements
}); });
}); });
measurementsRouter.put('/:id', function(req, res) { measurementsRouter.put('/:id', function(req, res) {
var measurements = MEASUREMENTS.filter(function(m) { var measurements = MEASUREMENTS.filter(function(m) {
return req.params.id.indexOf(m.id.toString()) > -1; return m.id == req.params.id;
}); });
res.send({ res.send({
'measurement': measurements[0] 'measurement': measurements[0]

View file

@ -73,7 +73,7 @@ module.exports = function(app) {
strainsRouter.get('/:id', function(req, res) { strainsRouter.get('/:id', function(req, res) {
var strains = STRAINS.filter(function(s) { var strains = STRAINS.filter(function(s) {
return req.params.id.indexOf(s.id.toString()) > -1; return s.id == req.params.id;
}); });
res.send({ res.send({
'strain': strains[0] 'strain': strains[0]
@ -82,7 +82,7 @@ module.exports = function(app) {
strainsRouter.put('/:id', function(req, res) { strainsRouter.put('/:id', function(req, res) {
var strains = STRAINS.filter(function(s) { var strains = STRAINS.filter(function(s) {
return req.params.id.indexOf(s.id.toString()) > -1; return s.id == req.params.id;
}); });
res.send({ res.send({
'strain': strains[0] 'strain': strains[0]