[#51,bugfix][xs]: fix bug in pulling of fields from document in createDataset (corrects error in 5fc486d8083a27db21993fc7d58c2c2dae75c17f).
This commit is contained in:
parent
d68529c113
commit
e3819d8f4e
@ -29,8 +29,8 @@ this.recline.Backend = this.recline.Backend || {};
|
||||
datasetInfo.fields = fields;
|
||||
} else {
|
||||
if (data) {
|
||||
datasetInfo.fields = _.map(data[0], function(cell) {
|
||||
return {id: cell};
|
||||
datasetInfo.fields = _.map(data[0], function(value, key) {
|
||||
return {id: key};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ var memoryData = {
|
||||
, name: '1-my-test-dataset'
|
||||
, id: 'test-dataset'
|
||||
},
|
||||
fields: [{id: 'x'}, {id: 'y'}, {id: 'z'}],
|
||||
fields: [{id: 'id'}, {id: 'x'}, {id: 'y'}, {id: 'z'}],
|
||||
documents: [
|
||||
{id: 0, x: 1, y: 2, z: 3}
|
||||
, {id: 1, x: 2, y: 4, z: 6}
|
||||
@ -32,6 +32,8 @@ test('Memory Backend: createDataset', function () {
|
||||
|
||||
test('Memory Backend: createDataset 2', function () {
|
||||
var dataset = recline.Backend.createDataset(memoryData.documents);
|
||||
equal(dataset.fields.length, 4);
|
||||
deepEqual(['id', 'x', 'y', 'z'], dataset.fields.pluck('id'));
|
||||
dataset.query();
|
||||
equal(memoryData.documents.length, dataset.currentDocuments.length);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user