Skip to content

Commit

Permalink
Adds _id attributes to initial data of mock
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelstofer committed Mar 26, 2013
1 parent c5075a9 commit 6ae954a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 11 additions & 2 deletions src/client/mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@ module.exports = function (options) {
client = require('./client'),
backend = require('../backends/memory'),
storage = require('../storage'),
socket = emitter({});
map = require('mapr').map,
socket = emitter({}),
data;

if (options.data) {
data = map(options.data, function (obj, id) {
obj._id = id;
return obj;
});
}

storage({
backend: backend({data: options.data})
backend: backend({data: data})
}).addClient(socket);
return client({socket: socket});
};
Expand Down
1 change: 0 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ describe('mock', function () {
var mock = storage.mock({
data: {
"10" : {
_id: "10",
example: 'expected'
}
}
Expand Down

0 comments on commit 6ae954a

Please sign in to comment.