Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rethinkdb-fixtures

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rethinkdb-fixtures - npm Package Compare versions

Comparing version 0.0.9 to 0.1.0

base.js

7

bin/delete.js

@@ -5,3 +5,6 @@ 'use strict';

Promise = require('bluebird');
const DB = process.env.RETHINKDB;
const USER = process.env.RDBUSER;
const PASSWORD = process.env.RDBPASSWORD;

@@ -18,4 +21,4 @@ if (!process.env.TABLES) {

const prep = require('../index')
.Base({ db: DB });
const Base = require('../base');
const prep = new Base({ db: DB, user: USER, password: PASSWORD });

@@ -22,0 +25,0 @@ prep.connect()

@@ -7,2 +7,4 @@ 'use strict';

const FIXTURE = process.env.FIXTURE;
const RDBUSER = process.env.RDBUSER;
const RDBPASSWORD = process.env.RDBPASSWORD;

@@ -21,12 +23,16 @@ if (!DB) {

const Readfixture = require('../index').Readfixture;
const Insert = require('../index').Insert;
const Readfixture = require('../readfixture');
const options = {
db: DB
db: DB,
user: RDBUSER,
password: RDBPASSWORD
};
const Insert = require('../index')(options).Insert;
Readfixture(FIXTURE).then( (fixture) => {
Insert(options,fixture).then( (createdObjects) => {
Insert(fixture).then( (createdObjects) => {

@@ -33,0 +39,0 @@ console.log(createdObjects);

'use strict';
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');
const Insert = require('./insert');
const Delete = require('./delete');
const Base = require('./base');
module.exports = function (config) {
const base = new Base(config);
return {
Insert: Insert(undefined,base),
Delete: Delete(undefined,base),
base: base
}
};
{
"name": "rethinkdb-fixtures",
"version": "0.0.9",
"version": "0.1.0",
"description": "Easily load fixtures into Rethinkdb. Useful for testing.",
"main": "index.js",
"scripts": {
"test": "lab -v -m 5000 -c -L",
"test": "lab -v -m 5000",
"linter": "lab -L",

@@ -31,5 +31,5 @@ "coverage": "lab -c -v",

"devDependencies": {
"code": "^3.0.2",
"lab": "^11.0.1"
"code": "^4.0.0",
"lab": "^11.1.0"
}
}

@@ -6,4 +6,3 @@ ## rethinkdb-fixtures

### Insert
```
const Insert = require('rethinkdb-fixtures').Insert;
```javascript

@@ -14,2 +13,4 @@ const options = {

};
const rdbFix = require('rethinkdb-fixtures')(options);
const Insert = rdbFix.Insert;

@@ -36,3 +37,3 @@ const fixture = {

Insert(options,fixture).then( (createdObjects) => {
Insert(fixture).then( (createdObjects) => {

@@ -44,3 +45,3 @@ console.log(createdObjects.items, createdObjects.people);

### Delete
```
```javascript
const options = {

@@ -50,4 +51,4 @@ db: 'test'

const Delete = require('rethinkdb-fixtures').Delete;
Delete(options, ['items', 'people']).then( (result) => {
const Delete = rdbFix.Delete;
Delete(['items', 'people']).then( (result) => {

@@ -57,2 +58,7 @@ console.log(result); // standard rethinkdb change objects

// close
rdbFix.base.close().then( () => {
console.log(`I've closed the connection`);
});
```

@@ -69,3 +75,3 @@

#### To insert:
```
```sh
export RETHINKDB=test

@@ -76,3 +82,3 @@ export FIXTURE=./fixtures.json

#### To delete tables
```
```sh
export RETHINKDB=test

@@ -79,0 +85,0 @@ export TABLES='table1,table2,table3'

'use strict';
Promise = require('bluebird');
const Base = require('../index').Base;
const Base = require('../base');
const Includes = require('lodash/includes');

@@ -13,4 +13,3 @@ const Lab = require('lab');

host: process.env.RETHINKDB_INSTANCE_PORT_8080_TCP_ADDR,
db: process.env.RETHINKDB || 'test',
user: 'test'
db: process.env.RETHINKDB || 'test'
};

@@ -17,0 +16,0 @@

'use strict';
const R = require('rethinkdb');
const Insert = require('../index').Insert;
const Lab = require('lab');

@@ -13,3 +13,2 @@ const Code = require('code');

db: process.env.RETHINKDB || 'test',
user: 'test',
verbose: true,

@@ -19,2 +18,4 @@ clear: true

const Insert = require('../index')(options).Insert;
const fixture = {

@@ -43,3 +44,3 @@ items: [

Insert(options, fixture)
Insert(fixture)
.then( (created) => {

@@ -51,3 +52,3 @@

return Insert(options, fixture);
return Insert(fixture);
})

@@ -54,0 +55,0 @@ .then( () => {

'use strict';
const Delete = require('../index').Delete;
const Insert = require('../index').Insert;
const Lab = require('lab');

@@ -14,6 +13,9 @@ const Code = require('code');

db: process.env.RETHINKDB || 'test',
user: 'test',
verbose: 1
};
const lib = require('../index')(options);
const Insert = lib.Insert;
const Delete = lib.Delete;
const fixture = {

@@ -42,3 +44,3 @@ items: [

Insert(options,fixture).then( (result) => {
Insert(fixture).then( (result) => {

@@ -51,3 +53,3 @@ done();

Delete(options, ['items', 'weirdos'])
Delete(['items', 'weirdos'])
.then( (result) => {

@@ -54,0 +56,0 @@

'use strict';
const Insert = require('../index').Insert;
const Delete = require('../index').Delete;
const Lab = require('lab');

@@ -13,6 +12,10 @@ const Code = require('code');

host: process.env.RETHINKDB_INSTANCE_PORT_8080_TCP_ADDR,
db: process.env.RETHINKDB || 'test',
user: 'test'
db: process.env.RETHINKDB || 'test'
};
const lib = require('../index')(options);
const Insert = lib.Insert;
const Delete = lib.Delete;
const fixture = {

@@ -38,3 +41,3 @@ items: [

Delete(options, ['items','artists']);
Delete(['items','artists']);
done();

@@ -45,3 +48,3 @@ });

Insert(options, fixture).then( (objects) => {
Insert(fixture).then( (objects) => {

@@ -55,4 +58,4 @@ const idx = objects.items.findIndex( (item) => {

done();
}, console.error);
}).catch(done);
});
});
'use strict';
const Readall = require('../index').all;
const Readall = require('../readall');
const Lab = require('lab');

@@ -5,0 +5,0 @@ const Code = require('code');

'use strict';
const Fs = require('fs');
const Readfixture = require('../lib/readfixture');
const Readfixture = require('../readfixture');
const Lab = require('lab');

@@ -6,0 +6,0 @@ const Code = require('code');

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc