1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

adds tests for editor-api.start()

This commit is contained in:
aaronmyatt 2020-12-16 21:53:52 +08:00
parent c9bc530df0
commit 55e6c6e01a

View File

@ -156,4 +156,27 @@ describe("api/index", function() {
}) })
}); });
describe('editor start', function (done) {
it('cannot be started when editor is disabled', function (done) {
const stub = sinon.stub(apiEditor, 'start', function () {
return Promise.resolve(true);
});
api.init({ httpAdminRoot: true, disableEditor: true }, {}, {}, {});
should(api.start()).resolvedWith(true);
stub.restore();
done();
});
it('can be started when editor enabled', function (done) {
const stub = sinon.stub(apiEditor, 'start');
api.init({ httpAdminRoot: true, disableEditor: false }, {}, {}, {});
api.start();
should(stub.called).be.true();
stub.restore();
done();
});
});
}); });