redoc/lib/components/Redoc/redoc.spec.ts

59 lines
1.5 KiB
TypeScript
Raw Normal View History

2015-12-19 01:54:06 +03:00
'use strict';
2016-06-12 20:44:34 +03:00
import { getChildDebugElement } from '../../../tests/helpers';
2016-08-22 12:12:13 +03:00
import { Component } from '@angular/core';
2015-12-19 01:54:06 +03:00
import {
2016-04-30 00:45:53 +03:00
inject,
2016-07-01 15:53:16 +03:00
async
2016-05-06 00:48:41 +03:00
} from '@angular/core/testing';
2016-09-02 23:18:31 +03:00
import { TestBed } from '@angular/core/testing';
2015-12-19 01:54:06 +03:00
2016-06-12 20:44:34 +03:00
import { Redoc } from './redoc';
2016-10-23 20:18:42 +03:00
import { SpecManager } from '../../utils/spec-manager';
2016-06-12 20:44:34 +03:00
import { OptionsService } from '../../services/index';
2015-12-30 02:29:29 +03:00
2016-06-12 20:44:34 +03:00
let optsMgr:OptionsService;
2015-12-19 01:54:06 +03:00
2015-12-19 20:36:28 +03:00
describe('Redoc components', () => {
2016-09-02 23:18:31 +03:00
beforeEach(() => {
TestBed.configureTestingModule({ declarations: [ TestAppComponent ] });
});
2015-12-19 20:36:28 +03:00
describe('Redoc Component', () => {
let builder;
let specMgr;
2016-07-01 15:53:16 +03:00
2016-09-02 23:18:31 +03:00
beforeEach(async(inject([SpecManager, OptionsService],
( _specMgr, _optsMgr) => {
2016-06-12 20:44:34 +03:00
optsMgr = _optsMgr;
2016-09-02 23:18:31 +03:00
specMgr = _specMgr;
2016-07-01 15:53:16 +03:00
return specMgr.load('/tests/schemas/extended-petstore.yml');
2016-04-30 00:45:53 +03:00
})));
2015-12-19 20:36:28 +03:00
2016-07-01 15:53:16 +03:00
it('should init component', () => {
2016-09-02 23:18:31 +03:00
let fixture = TestBed.createComponent(TestAppComponent);
2016-07-01 15:53:16 +03:00
let component = getChildDebugElement(fixture.debugElement, 'redoc').componentInstance;
expect(component).not.toBeNull();
fixture.destroy();
2015-12-19 20:36:28 +03:00
});
2016-07-01 15:53:16 +03:00
it('should init components tree without errors', () => {
2016-09-02 23:18:31 +03:00
let fixture = TestBed.createComponent(TestAppComponent);
2016-07-01 15:53:16 +03:00
(() => fixture.detectChanges()).should.not.throw();
fixture.destroy();
2015-12-19 20:36:28 +03:00
});
2015-12-19 18:32:29 +03:00
});
2016-01-20 17:37:23 +03:00
});
2015-12-30 11:16:36 +03:00
2015-12-19 14:36:05 +03:00
/** Test component that contains a Redoc. */
@Component({
selector: 'test-app',
2015-12-19 01:54:06 +03:00
template:
`<redoc disable-lazy-schemas></redoc>`
2015-12-19 01:54:06 +03:00
})
2016-06-13 20:54:24 +03:00
class TestAppComponent {
2015-12-19 01:54:06 +03:00
}