# rethinkdb-fixtures

> Easily load fixtures into Rethinkdb. Useful for testing.

Latest version **0.1.1** (published 2016-10-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install rethinkdb-fixtures
pnpm add rethinkdb-fixtures
yarn add rethinkdb-fixtures
bun add rethinkdb-fixtures
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2016-10-11 |
| First published | 2016-02-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Thomas Eng |
| Maintainers | athlite |
| Keywords | Rethinkdb, testing, fixtures |

## Links

- npm: https://www.npmjs.com/package/rethinkdb-fixtures
- Repository: https://github.com/athlite/rethinkdb-fixtures
- Homepage: https://github.com/athlite/rethinkdb-fixtures#readme
- Issues: https://github.com/athlite/rethinkdb-fixtures/issues
- npm.io page: https://npm.io/package/rethinkdb-fixtures

## Dependencies (4)

- [glob](https://npm.io/package/glob.md) ^7.0.6
- [lodash](https://npm.io/package/lodash.md) ^4.15.0
- [bluebird](https://npm.io/package/bluebird.md) ^3.4.6
- [rethinkdb](https://npm.io/package/rethinkdb.md) ^2.3.3

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2016-10-11
- 0.1.0 — 2016-10-11
- 0.0.9 — 2016-09-19
- 0.0.8 — 2016-09-05
- 0.0.7 — 2016-09-05
- 0.0.6 — 2016-09-05
- 0.0.5 — 2016-06-10
- 0.0.4 — 2016-06-09
- 0.0.3 — 2016-02-03
- 0.0.2 — 2016-02-02
- 0.0.1 — 2016-02-01

## README

## rethinkdb-fixtures

Easily load fixtures into Rethinkdb. Useful for testing.

### Insert
```javascript

const options = {
    db: 'test',
    clear: true // This will make sure tables are cleared before inserting.
};
const rdbFix = require('rethinkdb-fixtures')(options);
const Insert = rdbFix.Insert;

const fixture = {
        items: [
            {
                name: 'Bike'
            },
            {
                name: 'Wrench'
            }
        ],
        people: [
            {
                name: 'Wild Man Fischer'
            },
            {
                name: 'Charles Ponzi'
            }
        ]
    }
};

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

    console.log(createdObjects.items, createdObjects.people);
}, console.error);
```

### Delete
```javascript

const Delete = rdbFix.Delete;
Delete(['items', 'people']).then( (result) => {

    console.log(result); // standard rethinkdb change objects
},console.error);
```

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:
```sh
export RETHINKDB=test
export FIXTURE=./fixtures.json
node ./bin/insert.js
```
#### To delete tables
```sh
export RETHINKDB=test
export TABLES='table1,table2,table3'
node ./bin/delete.js
```

---
_Source: https://npm.io/package/rethinkdb-fixtures · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
