boost api index, nodes index and nodes Node test coverage

This commit is contained in:
dceejay
2015-03-06 22:58:30 +00:00
parent 910d983b82
commit 69f85bd688
5 changed files with 52 additions and 32 deletions

View File

@@ -19,24 +19,22 @@ var request = require("supertest");
var express = require("express");
var fs = require("fs");
var path = require("path");
var settings = require("../../../red/settings");
var api = require("../../../red/api");
describe("api index", function() {
var app;
describe("disables editor", function() {
before(function() {
settings.init({disableEditor:true});
settings.init({disableEditor:true,adminAuth:{type: "credentials",users:[],default:{permissions:"read"}}});
app = express();
api.init(app);
});
after(function() {
settings.reset();
});
it('does not serve the editor', function(done) {
request(app)
.get("/")
@@ -53,7 +51,7 @@ describe("api index", function() {
.expect(200,done)
});
});
describe("enables editor", function() {
before(function() {
settings.init({disableEditor:false});
@@ -63,7 +61,7 @@ describe("api index", function() {
after(function() {
settings.reset();
});
it('serves the editor', function(done) {
request(app)
.get("/")
@@ -88,5 +86,10 @@ describe("api index", function() {
.get("/settings")
.expect(200,done)
});
it('handles page not there', function(done) {
request(app)
.get("/foo")
.expect(404,done)
});
});
});
});