Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Latest commit

 

History

History
62 lines (48 loc) · 1.12 KB

Readme.md

File metadata and controls

62 lines (48 loc) · 1.12 KB

Fixr

build status

Create data fixtures for testing Node.js projects.

Currently only works with Postgres, more engines can be easily added for other SQL servers.

This project is very new and thus the API is subject to incompatible changes.

Example

fixtures/users.json

{
  "users": [
    {
      "email": "[email protected]",
      "password": "CFDD77B787114C"
    },
    {
      "email": "[email protected]",
      "password": "3C404BD9DA9523"
    }
  ]
}

users_test.js

var Fixr = require('fixr');
var assert = require('assert');

var engineConfig = {
  host: 'localhost',
  port: 5432,
  database: 'mydb_test',
  user: 'postgres',
  password: ''
};

var fixr = new Fixr.Fixr(engineConfig);
fixr.fix('./fixtures/users', function(err) {
  assert.ifError(err);
  console.log('fixture data loaded!');
  /*
   * do some test that requires user data loaded by the fixture
   */
});

Install

npm install fixr

Mentions

  • SQL statement generation provided by sql