Skip to content

Create data fixtures for testing Node.js projects

Notifications You must be signed in to change notification settings

timlesallen/node-fixr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

build status

Fixr

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": "user1@example.com",
      "password": "CFDD77B787114C"
    },
    {
      "email": "user2@example.com",
      "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(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-compiled

Mentions

  • SQL statement generation provided by sql

About

Create data fixtures for testing Node.js projects

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CoffeeScript 97.1%
  • JavaScript 2.9%