Read to test database loading

pull/2/head
Louis Chatriot 12 years ago
parent 3663b2b0b0
commit e4f1af34c3
  1. 9
      lib/datastore.js
  2. 10
      test/db.test.js

@ -56,17 +56,18 @@ Datastore.prototype.loadDatabase = function (cb) {
*/ */
Datastore.treatRawData = function (rawData) { Datastore.treatRawData = function (rawData) {
var data = rawData.split('\n') var data = rawData.split('\n')
, res = []; , res = []
, i;
data.forEach(function (d) { for (i = 0; i < data.length; i += 1) {
var doc; var doc;
try { try {
doc = model.deserialize(d); doc = model.deserialize(data[i]);
res.push(doc); res.push(doc);
} catch (e) { } catch (e) {
} }
}); }
return res; return res;
}; };

@ -34,6 +34,16 @@ describe('Database', function () {
}); });
describe('Loading the database data from file', function () {
it('Every line represents a document', function () {
// TODO
});
}); // ==== End of 'Loading the database data from file' ==== //
describe('Insert', function () { describe('Insert', function () {
it('Able to insert a document in the database, setting an _id if none provided, and retrieve it even after a reload', function (done) { it('Able to insert a document in the database, setting an _id if none provided, and retrieve it even after a reload', function (done) {

Loading…
Cancel
Save