fix tests

This commit is contained in:
Nolan Lawson 2014-10-24 22:23:49 -04:00
parent cf6b6f8264
commit 7314b1c242

View File

@ -2,8 +2,6 @@
'use strict';
var PouchDB = require('pouchdb');
var COUCH_HOST = process.env.COUCH_HOST || 'http://127.0.0.1:5984';
var HTTP_PORT = 8001;
var Promise = require('bluebird');
@ -43,31 +41,8 @@ function bundle() {
function startServers(callback) {
readyCallback = callback;
// enable CORS globally, because it's easier this way
var corsValues = {
'/_config/httpd/enable_cors': 'true',
'/_config/cors/origins': '*',
'/_config/cors/credentials': 'true',
'/_config/cors/methods': 'PROPFIND, PROPPATCH, COPY, MOVE, DELETE, ' +
'MKCOL, LOCK, UNLOCK, PUT, GETLIB, VERSION-CONTROL, CHECKIN, ' +
'CHECKOUT, UNCHECKOUT, REPORT, UPDATE, CANCELUPLOAD, HEAD, ' +
'OPTIONS, GET, POST',
'/_config/cors/headers':
'Cache-Control, Content-Type, Depth, Destination, ' +
'If-Modified-Since, Overwrite, User-Agent, X-File-Name, ' +
'X-File-Size, X-Requested-With, accept, accept-encoding, ' +
'accept-language, authorization, content-type, origin, referer'
};
Promise.all(Object.keys(corsValues).map(function (key) {
var value = corsValues[key];
return request({
method: 'put',
url: COUCH_HOST + key,
body: JSON.stringify(value)
});
})).then(function () {
Promise.resolve().then(function () {
return http_server.createServer().listen(HTTP_PORT);
}).then(function () {
console.log('Tests: http://127.0.0.1:' + HTTP_PORT + '/test/index.html');