From 55e6c6e01adf0afc71ec1601be727f21a9685c51 Mon Sep 17 00:00:00 2001 From: aaronmyatt Date: Wed, 16 Dec 2020 21:53:52 +0800 Subject: [PATCH] adds tests for editor-api.start() --- .../@node-red/editor-api/lib/index_spec.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/unit/@node-red/editor-api/lib/index_spec.js b/test/unit/@node-red/editor-api/lib/index_spec.js index 2f84030aa..28928181b 100644 --- a/test/unit/@node-red/editor-api/lib/index_spec.js +++ b/test/unit/@node-red/editor-api/lib/index_spec.js @@ -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(); + }); + + }); + });