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

Commit

Permalink
added test, fixed server prefix and db names
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-aladev committed Jul 21, 2016
1 parent 1287a83 commit 41ccfd0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
11 changes: 6 additions & 5 deletions sample/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ webServer.listen(webAppPort, function () {
});
webServer.on('error', onError);

var pouchDBName = 'db';
if (! fs.existsSync('./' + pouchDBName)){
fs.mkdirSync('./' + pouchDBName);
// prefix dir should exist.
var prefixDir = './db';
if (! fs.existsSync(prefixDir)){
fs.mkdirSync(prefixDir);
}
var pbsetup = PouchDB.defaults({ prefix: './' + pouchDBName + '/' });
var pbsetup = PouchDB.defaults({ prefix: prefixDir + '/' });
var pouchPort = normalizePort(process.env.PORT2 || '3001');

var opts = {
Expand All @@ -43,7 +44,7 @@ router.all('*', function(req, res, next) {
next();
});
//Norml middleware usage..
router.all('*', acllib(pouchDBName, acl, function (thaliId) {
router.all('*', acllib('foobarrepl', acl, function (thaliId) {
debug('thaliId %s', thaliId);
}));

Expand Down
5 changes: 2 additions & 3 deletions test/test-core-alldocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('test-core-db-2.js - calling the /db path', function() {
//Norml middleware usage..0
var acl = require('./acl-block.1.js');
router.all('*', lib('foobar', acl, function(){}));
//mock handlers
//mock handlers
app.use('/', genericHandlers(router, path));
})

Expand All @@ -60,7 +60,7 @@ describe('test-core-db-2.js - calling the /db path', function() {
.set('Accept', 'application/json')
.expect(200, done);
})
it('HEADz should be 200', function(done) {
it('HEAD should be 200', function(done) {
request(app)
.head(path)
.set('Accept', 'application/json')
Expand All @@ -74,4 +74,3 @@ describe('test-core-db-2.js - calling the /db path', function() {
})
})
})

6 changes: 3 additions & 3 deletions test/test-noaclfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('test-noaclfile.js - should let all through', function() {

before(function() {
router.all('*', function(req, res, next) {
req.connection.pskIdentity = 'public';
req.connection.pskRole = 'public';
next();
})
router.all('*', lib('foobar', [{}], function(){}));
Expand All @@ -66,7 +66,7 @@ describe('test-noaclfile.js - should let all through', function() {
before(function() {
//mocker..
router.all('*', function(req, res, next) {
req.connection.pskIdentity = 'user';
req.connection.pskRole = 'user';
next();
})
//Norml middleware usage..
Expand All @@ -82,4 +82,4 @@ describe('test-noaclfile.js - should let all through', function() {
.expect(401, done);
})
})
})
})

0 comments on commit 41ccfd0

Please sign in to comment.