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. 24
      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();

24
test/unit/middleware/assignLabels.js

@ -43,14 +43,10 @@ module.exports.tests.serialization = function(test, common) {
var input = {
data: [
{
parent: {
id: 1
}
id: 1
},
{
parent: {
id: 2
}
id: 2
}
]
};
@ -58,15 +54,11 @@ module.exports.tests.serialization = function(test, common) {
var expected = {
data: [
{
parent: {
id: 1
},
id: 1,
label: 'label 1'
},
{
parent: {
id: 2
},
id: 2,
label: 'label 2'
}
]
@ -91,9 +83,7 @@ module.exports.tests.serialization = function(test, common) {
var input = {
data: [
{
parent: {
id: 1
}
id: 1
}
]
};
@ -101,9 +91,7 @@ module.exports.tests.serialization = function(test, common) {
var expected = {
data: [
{
parent: {
id: 1
},
id: 1,
label: 'label 1'
}
]

Loading…
Cancel
Save