From 7e11eb56e79ac09189a9786369d4eb30df67f8be Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Tue, 22 Dec 2015 18:16:57 +0200 Subject: [PATCH] Add Redoc init spec --- lib/index.spec.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lib/index.spec.js diff --git a/lib/index.spec.js b/lib/index.spec.js new file mode 100644 index 00000000..1ee1d0bb --- /dev/null +++ b/lib/index.spec.js @@ -0,0 +1,26 @@ +'use strict'; +import {init} from 'lib/index'; + +describe('Redoc init', () => { + it('should return promise', () => { + let res = init(); + res.should.be.instanceof(Promise); + }); + + it('should reject promise for not specifed url', (done) => { + let res = init(); + res.then(() => { done.fail('Should not been called'); }, () => { + done(); + }); + }); + + //skip because of PhantomJS crashes on this testcase + xit('should init redoc', (done) => { + var node = document.createElement('redoc'); + document.body.appendChild(node); + let res = init('/tests/schemas/extended-petstore.json'); + res.then(() => { done(); }, () => { + done.fail('Error handler should not been called'); + }); + }); +});