Skip to content

Commit

Permalink
test: remoteBaseUrl constructor tests
Browse files Browse the repository at this point in the history
Adding tests for constructor when using the remoteBaseUrl option.
  • Loading branch information
capellini committed Jul 5, 2017
1 parent 87df218 commit 33af85b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/integration/constructor.js
@@ -1,4 +1,5 @@
var assign = require('lodash/assign')
var simple = require('simple-mock');
var test = require('tape')

var PouchDB = require('../utils/pouchdb.js')
Expand Down Expand Up @@ -93,3 +94,28 @@ test('new Store(db, options) with options.remote being a getter', function (t) {
store.sync()
store.sync()
})

test('new Store(db, options) with remoteBaseUrl and no remote', function (t) {
var options = {
PouchDB: PouchDB,
remoteBaseUrl: 'http://localhost:5984'
}
var store = new Store('test-db', options)

t.is(options.remote, 'http://localhost:5984/test-db', 'sets .remote on instance')

t.end()
})

test('new Store(db, options) with remoteBaseUrl and https:// remote', function (t) {
var options = {
PouchDB: PouchDB,
remote: 'https://hood.ie:5984',
remoteBaseUrl: 'http://localhost:5984'
}
var store = new Store('test-db', options)

t.is(options.remote, 'https://hood.ie:5984', '.remote unchanged when it is an https endpoint')

t.end()
})

0 comments on commit 33af85b

Please sign in to comment.