mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
boost api index, nodes index and nodes Node test coverage
This commit is contained in:
@@ -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)
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user