mirror of
https://github.com/Redocly/redoc.git
synced 2025-01-31 10:04:08 +03:00
Clean up tests
This commit is contained in:
parent
81d06316ed
commit
4a475677f7
|
@ -58,7 +58,7 @@ describe('Redoc components', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return promise', () => {
|
it('should return promise', () => {
|
||||||
let res = Redoc.init();
|
let res = Redoc.init().catch(() => {/**/});
|
||||||
res.should.be.instanceof(Promise);
|
res.should.be.instanceof(Promise);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ describe('Redoc components', () => {
|
||||||
spyOn(Redoc, 'hideLoadingAnimation').and.callThrough();
|
spyOn(Redoc, 'hideLoadingAnimation').and.callThrough();
|
||||||
spyOn(Redoc, 'displayError').and.callThrough();
|
spyOn(Redoc, 'displayError').and.callThrough();
|
||||||
let res = Redoc.init();
|
let res = Redoc.init();
|
||||||
return res.then(() => {
|
return res.catch(() => {
|
||||||
expect(Redoc.hideLoadingAnimation).toHaveBeenCalled();
|
expect(Redoc.hideLoadingAnimation).toHaveBeenCalled();
|
||||||
expect(Redoc.displayError).toHaveBeenCalled();
|
expect(Redoc.displayError).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
|
@ -79,10 +79,10 @@ export class Redoc extends BaseComponent implements AfterViewInit {
|
||||||
Redoc.hideLoadingAnimation();
|
Redoc.hideLoadingAnimation();
|
||||||
Redoc.appRef = appRef;
|
Redoc.appRef = appRef;
|
||||||
console.log('ReDoc bootstrapped!');
|
console.log('ReDoc bootstrapped!');
|
||||||
}, err => {
|
}).catch(err => {
|
||||||
console.log(err);
|
|
||||||
Redoc.hideLoadingAnimation();
|
Redoc.hideLoadingAnimation();
|
||||||
Redoc.displayError(err);
|
Redoc.displayError(err);
|
||||||
|
throw err;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,6 @@ export class Redoc extends BaseComponent implements AfterViewInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
static displayError(err) {
|
static displayError(err) {
|
||||||
console.log(err);
|
|
||||||
let redocEl = dom.query('redoc');
|
let redocEl = dom.query('redoc');
|
||||||
if (!redocEl) return;
|
if (!redocEl) return;
|
||||||
let heading = 'Oops... ReDoc failed to render this spec';
|
let heading = 'Oops... ReDoc failed to render this spec';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { getChildDebugElement } from '../../../tests/helpers';
|
import { getChildDebugElement } from '../../../tests/helpers';
|
||||||
import { Component, provide } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { OptionsService } from '../../services/index';
|
import { OptionsService } from '../../services/index';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -111,9 +111,18 @@ describe('Spec Helper', () => {
|
||||||
let resolved;
|
let resolved;
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
let pointer = '/paths/test5/get/parameters/0';
|
let pointer = '/paths/test5/get/parameters/0';
|
||||||
|
spyOn(console, 'warn').and.stub();
|
||||||
resolved = normalizer.normalize(specMgr.byPointer(pointer), pointer);
|
resolved = normalizer.normalize(specMgr.byPointer(pointer), pointer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
(<jasmine.Spy>console.warn).and.callThrough();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should print warning to console', () => {
|
||||||
|
expect(console.warn).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
it('should skip other fields', () => {
|
it('should skip other fields', () => {
|
||||||
expect(resolved.$ref).toBeUndefined();
|
expect(resolved.$ref).toBeUndefined();
|
||||||
expect(resolved.title).toBeDefined();
|
expect(resolved.title).toBeDefined();
|
||||||
|
|
|
@ -110,8 +110,6 @@
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"$ref": "#/definitions/CircularTransitive",
|
"$ref": "#/definitions/CircularTransitive",
|
||||||
"title": "test",
|
|
||||||
"description": "test"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user