sails-memory-restorable

0.10.7 • Public • Published

image_squidhome@2x.png

sails-memory

Tested with Sails 0.9

Extract from my bootstrap.test.js

This populates barrels with the fixtures, saves the states and then saves the state restoring it before running each test

var setupFixtures = _.once(() => new Promise(function (resolve) {
  barrels.populate([
    'centres',
    'subjects',
    'movement',
    'detainee',
    'event',
    'heartbeat',
    'prebooking',
    'bed',
    'bedevent',
    'port'
  ], function (err) {
    if (err) throw err;
    Sails.adapters['sails-memory'].saveState('test');
    resolve();
  });

}));


module.exports = {
  beforeEach: () => setupFixtures()
      .then(() => {
        Sails.adapters['sails-memory'].restoreState('test');
      });
  }
};

An in-memory object store which works great as a bundled, starter database (with the strict caveat that it is for non-production use only).

About Sails.js

http://sailsjs.com

About Waterline

Waterline is a new kind of storage and retrieval engine. It provides a uniform API for accessing stuff from different kinds of databases, protocols, and 3rd party APIs. That means you write the same code to get users, whether they live in mySQL, LDAP, MongoDB, or Facebook.

githalytics.com alpha

Package Sidebar

Install

npm i sails-memory-restorable

Weekly Downloads

4

Version

0.10.7

License

MIT

Last publish

Collaborators

  • chrisns