[FIX] web: mockRead all fields if no field specified

When mocking a `read`, the mock server should return all fields if no
field are specified in the `read` parameters.
This commit is contained in:
Martin Geubelle
2017-04-11 19:44:38 +02:00
committed by Aaron Bohy
parent 5fe3c86165
commit 7f4e552e3f
@@ -492,7 +492,7 @@ var MockServer = Class.extend({
if (!_.isArray(ids)) {
ids = [ids];
}
var fields = args[1] ? _.uniq(args[1].concat(['id'])) : Object.keys(this.data[model].fields);
var fields = args[1] && args[1].length ? _.uniq(args[1].concat(['id'])) : Object.keys(this.data[model].fields);
var results = _.map(ids, function (id) {
var record = _.findWhere(self.data[model].records, {id: id});
if (!record) {