rethinkdb-fixtures
Advanced tools
Comparing version 0.0.3 to 0.0.4
'use strict'; | ||
module.exports.Prepare = require('./lib/prepare'); | ||
module.exports.Readfixture = require('./lib/readfixture'); | ||
module.exports.all = require('./lib/readall'); | ||
module.exports.Base = require('./lib/base'); | ||
module.exports.Insert = require('./lib/insert'); | ||
module.exports.Delete = require('./lib/delete'); |
'use strict'; | ||
const Promise = require('bluebird'); | ||
const Prepare = require('./prepare'); | ||
Promise = require('bluebird'); | ||
const Base = require('./base'); | ||
const _delete = function (dbOptions,tables) { | ||
const _delete = function (tables) { | ||
const prep = Prepare(dbOptions); | ||
return new Promise( (resolve,reject) => { | ||
prep.connect() | ||
this.connect() | ||
.then((message) => { | ||
@@ -17,3 +15,3 @@ | ||
return prep.deleteTable(table); | ||
return this.deleteTable(table); | ||
}); | ||
@@ -25,2 +23,3 @@ return Promise.all(promises); | ||
resolve(result); | ||
this.close(); | ||
}, reject); | ||
@@ -30,2 +29,5 @@ }); | ||
module.exports = _delete; | ||
module.exports = function(options,tables) { | ||
return _delete.call(new Base(options),tables); | ||
}; |
'use strict'; | ||
const Promise = require('bluebird'); | ||
const Prepare = require('./prepare'); | ||
Promise = require('bluebird'); | ||
const insert = function (options, fixture) { | ||
const Base = require('./base'); | ||
const prep = Prepare(options); | ||
let messageCallback = function () {}; | ||
const insert = function (fixture) { | ||
if (options.verbose === 1) { | ||
messageCallback = console.log; | ||
} | ||
return new Promise( (resolve,reject) => { | ||
prep.connect() | ||
.then(messageCallback, reject) | ||
.then(prep.createTablesUnlessExist.bind(prep,Object.keys(fixture)),reject) | ||
.then(prep.fill.bind(prep, fixture),reject) | ||
this.connect() | ||
.then(this.emptyCallback.bind(this), reject) | ||
.then(this.createTablesUnlessExist.bind(this,Object.keys(fixture)),reject) | ||
.then(this.fill.bind(this, fixture),reject) | ||
.then( (result) => { | ||
@@ -30,4 +24,4 @@ | ||
this.close(); | ||
resolve(pack); | ||
prep.close(); | ||
},reject); | ||
@@ -37,2 +31,5 @@ }); | ||
module.exports = insert; | ||
module.exports = function(options,fixture) { | ||
return insert.call(new Base(options),fixture); | ||
}; |
{ | ||
"name": "rethinkdb-fixtures", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Easily load fixtures into Rethinkdb. Useful for testing.", | ||
@@ -25,10 +25,11 @@ "main": "index.js", | ||
"dependencies": { | ||
"bluebird": "^3.1.5", | ||
"lodash": "^4.0.1", | ||
"rethinkdb": "^2.2.1" | ||
"bluebird": "^3.4.0", | ||
"glob": "^7.0.3", | ||
"lodash": "^4.13.1", | ||
"rethinkdb": "^2.3.2" | ||
}, | ||
"devDependencies": { | ||
"code": "^2.1.0", | ||
"lab": "^8.0.1" | ||
"code": "^3.0.0", | ||
"lab": "^10.7.1" | ||
} | ||
} |
@@ -12,3 +12,4 @@ 'use strict'; | ||
const options = { | ||
db: 'test', | ||
host: process.env.RETHINKDB_PORT_8080_TCP_ADDR, | ||
db: process.env.RETHINKDB || 'test', | ||
verbose: 1 | ||
@@ -15,0 +16,0 @@ }; |
'use strict'; | ||
const Insert = require('../index').Insert; | ||
const Delete = require('../index').Delete; | ||
const Lab = require('lab'); | ||
@@ -11,3 +12,4 @@ const Code = require('code'); | ||
const options = { | ||
db: 'test' | ||
host: process.env.RETHINKDB_PORT_8080_TCP_ADDR, | ||
db: process.env.RETHINKDB || 'test' | ||
}; | ||
@@ -33,2 +35,8 @@ | ||
lab.after( (done) => { | ||
Delete(options, ['items','artists']); | ||
done(); | ||
}); | ||
lab.test('it inserts', (done) => { | ||
@@ -35,0 +43,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19065
22
617
4
13
1
+ Addedglob@^7.0.3
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedwrappy@1.0.2(transitive)
Updatedbluebird@^3.4.0
Updatedlodash@^4.13.1
Updatedrethinkdb@^2.3.2