dynafixtures
Version:
Fixtures for DynamoDB
41 lines (35 loc) • 880 B
JavaScript
;
var dynafixtures = require('../index'),
aws = require('aws-sdk');
var tables = process.cwd() + '/test_tables.json';
var fixtures = [
process.cwd() + '/Forum_fixture.json',
process.cwd() + '/fixture2.json'
];
dynafixtures.setup(tables, fixtures, null, function(err){
if (err) {
console.log(err);
}
// Count amount of items
var params = {
TableName: 'Forum'
};
var db = new aws.DynamoDB({
'accessKeyId': 'a',
'secretAccessKey':'b',
'endpoint':'http://localhost:4567',
'region': 'eu-west-1'
});
db.scan(params, function(err,data){
if (err) {
console.log(err);
}
// Should be 5
console.log(data);
dynafixtures.teardown(function(err){
if (err) {
console.log(err);
}
});
});
});