Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

Commit

Permalink
Test Multiple Instances (#7)
Browse files Browse the repository at this point in the history
* Tested running 'rethinkdb' from multiple test files.

* Fix lint
  • Loading branch information
CodeLenny authored and rrdelaney committed Jul 25, 2017
1 parent 29ab864 commit 3bbfd75
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 11 deletions.
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
"type": "git",
"url": "https://github.com/rrdelaney/ava-rethinkdb"
},
"keywords": [
"ava",
"rethinkdb"
],
"keywords": ["ava", "rethinkdb"],
"author": "Ryan Delaney <rrdelaney@outlook.com>",
"license": "MIT",
"bugs": {
Expand All @@ -24,6 +21,7 @@
"ava": "^0.21.0 || <= 0.21.0"
},
"devDependencies": {
"babel-eslint": "^7.2.3",
"ava": "^0.21.0",
"rethinkdb": "^2.3.2",
"snazzy": "^4.0.0",
Expand All @@ -34,8 +32,6 @@
"rimraf": "^2.5.2"
},
"standard": {
"ignore": [
"test"
]
"parser": "babel-eslint"
}
}
11 changes: 11 additions & 0 deletions test/helpers/single-instance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import test from 'ava'
import r from 'rethinkdb'
import { init, cleanup } from '../../'

test.before('Initialize DB', init())
test.after.always('Teardown DB', cleanup)

test('connects to database', async t => {
let connection = await r.connect({})
t.true(connection.open)
})
6 changes: 3 additions & 3 deletions test/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ const TEST_DATA = {
},
test: {
data: [
{ something: true },
],
},
{ something: true }
]
}
}

test.before('Initialize DB', init(TEST_DATA))
Expand Down
11 changes: 11 additions & 0 deletions test/multiple-instances/instance1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import test from 'ava'
import r from 'rethinkdb'
import { init, cleanup } from '../../'

test.before('Initialize DB', init())
test.after.always('Teardown DB', cleanup)

test('connects to database', async t => {
let connection = await r.connect({})
t.true(connection.open)
})
11 changes: 11 additions & 0 deletions test/multiple-instances/instance2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import test from 'ava'
import r from 'rethinkdb'
import { init, cleanup } from '../../'

test.before('Initialize DB', init())
test.after.always('Teardown DB', cleanup)

test('connects to database', async t => {
let connection = await r.connect({})
t.true(connection.open)
})
2 changes: 1 addition & 1 deletion test/port-offset.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ test('port offsets shouldn\'t exceed the maximum offset', async t => {
t.true(getPortOffset(maxOffset) <= maxOffset)
t.true(getPortOffset(maxOffset * 2) <= maxOffset)
t.true(getPortOffset(maxOffset * 2.5) <= maxOffset)
});
})

0 comments on commit 3bbfd75

Please sign in to comment.