Browse Source

changed the variable passed to the label generator

pull/680/head
Stephen Hess 8 years ago
parent
commit
d230367f02
  1. 2
      middleware/assignLabels.js
  2. 18
      test/unit/middleware/assignLabels.js

2
middleware/assignLabels.js

@ -16,7 +16,7 @@ function assignLabel(req, res, next, labelGenerator) {
}
res.data.forEach(function (result) {
result.label = labelGenerator(result.parent);
result.label = labelGenerator(result);
});
next();

18
test/unit/middleware/assignLabels.js

@ -43,30 +43,22 @@ module.exports.tests.serialization = function(test, common) {
var input = {
data: [
{
parent: {
id: 1
}
},
{
parent: {
id: 2
}
}
]
};
var expected = {
data: [
{
parent: {
id: 1
},
id: 1,
label: 'label 1'
},
{
parent: {
id: 2
},
id: 2,
label: 'label 2'
}
]
@ -91,19 +83,15 @@ module.exports.tests.serialization = function(test, common) {
var input = {
data: [
{
parent: {
id: 1
}
}
]
};
var expected = {
data: [
{
parent: {
id: 1
},
id: 1,
label: 'label 1'
}
]

Loading…
Cancel
Save