rethinkdb-fixtures
Easily load fixtures into Rethinkdb. Useful for testing.
Insert
const options = db: 'test' clear: true // This will make sure tables are cleared before inserting.;const rdbFix = options;const Insert = rdbFixInsert; const fixture = items: name: 'Bike' name: 'Wrench' people: name: 'Wild Man Fischer' name: 'Charles Ponzi' }; ;
Delete
const Delete = rdbFixDelete;;
Closing connection
rdbFix.base.close().then( function () {
console.log(`I've closed the connection`);
});
To test:
make sure you have an instance of rethinkdb running somewhere
npm test
Command line usage
To insert:
export RETHINKDB=testexport FIXTURE=./fixtures.jsonnode ./bin/insert.js
To delete tables
export RETHINKDB=testexport TABLES='table1,table2,table3'node ./bin/delete.js