2015-12-19 03:24:25 +03:00
|
|
|
'use strict';
|
|
|
|
|
2016-07-01 15:53:16 +03:00
|
|
|
import { Component } from '@angular/core';
|
2015-12-19 03:24:25 +03:00
|
|
|
import {
|
2016-04-30 00:45:53 +03:00
|
|
|
inject,
|
2016-05-06 00:48:41 +03:00
|
|
|
async,
|
2016-09-02 23:18:31 +03:00
|
|
|
TestBed
|
2016-05-06 00:48:41 +03:00
|
|
|
} from '@angular/core/testing';
|
2015-12-19 03:24:25 +03:00
|
|
|
|
2016-06-12 20:44:34 +03:00
|
|
|
import { getChildDebugElement } from '../../../tests/helpers';
|
2016-05-06 12:46:41 +03:00
|
|
|
|
2016-06-12 20:44:34 +03:00
|
|
|
import { Method } from './method';
|
2016-10-23 20:18:42 +03:00
|
|
|
import { SpecManager } from '../../utils/spec-manager';;
|
2016-11-24 16:29:29 +03:00
|
|
|
import { LazyTasksService } from '../../shared/components/LazyFor/lazy-for';;
|
2015-12-19 03:24:25 +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('Method Component', () => {
|
|
|
|
let builder;
|
2017-02-26 00:38:19 +03:00
|
|
|
let component: Method;
|
2016-11-24 16:29:29 +03:00
|
|
|
let specMgr;
|
2016-07-01 15:53:16 +03:00
|
|
|
|
2016-11-24 16:29:29 +03:00
|
|
|
beforeEach(async(inject([SpecManager, LazyTasksService], (_specMgr, lazyTasks) => {
|
|
|
|
lazyTasks.sync = true;
|
|
|
|
specMgr = _specMgr;
|
2016-04-30 00:45:53 +03:00
|
|
|
})));
|
2016-07-01 15:53:16 +03:00
|
|
|
|
2016-11-24 16:29:29 +03:00
|
|
|
beforeEach(done => {
|
|
|
|
specMgr.load('/tests/schemas/extended-petstore.yml').then(done, done.fail);
|
|
|
|
});
|
|
|
|
|
2016-07-01 15:53:16 +03:00
|
|
|
beforeEach(() => {
|
2016-09-02 23:18:31 +03:00
|
|
|
let fixture = TestBed.createComponent(TestAppComponent);
|
2016-07-01 15:53:16 +03:00
|
|
|
component = getChildDebugElement(fixture.debugElement, 'method').componentInstance;
|
|
|
|
fixture.detectChanges();
|
2015-12-19 20:36:28 +03:00
|
|
|
});
|
2015-12-19 03:24:25 +03:00
|
|
|
|
|
|
|
|
2015-12-19 20:36:28 +03:00
|
|
|
it('should init component', () => {
|
|
|
|
expect(component).not.toBeNull();
|
|
|
|
});
|
2015-12-19 14:36:05 +03:00
|
|
|
|
2015-12-19 20:36:28 +03:00
|
|
|
it('should init basic component data', () => {
|
2017-02-26 00:38:19 +03:00
|
|
|
component.method.verb.should.be.equal('put');
|
2016-07-20 11:07:08 +03:00
|
|
|
component.method.path.should.be.equal('/user/{username}');
|
2015-12-19 20:36:28 +03:00
|
|
|
});
|
2015-12-19 14:36:05 +03:00
|
|
|
|
|
|
|
|
2015-12-19 20:36:28 +03:00
|
|
|
it('should main tag', () => {
|
2016-07-20 11:07:08 +03:00
|
|
|
component.method.info.tags.should.be.empty();
|
2015-12-19 20:36:28 +03:00
|
|
|
});
|
2015-12-19 03:24:25 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-12-19 14:36:05 +03:00
|
|
|
/** Test component that contains a Method. */
|
2016-03-27 18:25:46 +03:00
|
|
|
@Component({
|
|
|
|
selector: 'test-app',
|
2015-12-19 03:24:25 +03:00
|
|
|
template:
|
|
|
|
`<method pointer='#/paths/~1user~1{username}/put'></method>`
|
|
|
|
})
|
2016-06-13 20:54:24 +03:00
|
|
|
class TestAppComponent {
|
2015-12-19 03:24:25 +03:00
|
|
|
}
|