redoc/lib/components/OperationsList/operations-list.spec.ts

63 lines
1.6 KiB
TypeScript
Raw Normal View History

2015-12-19 18:19:18 +03:00
'use strict';
2016-07-01 16:30:35 +03:00
import { Component } from '@angular/core';
2015-12-19 18:19:18 +03:00
import {
2016-04-30 00:45:53 +03:00
inject,
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 18:19:18 +03:00
2016-06-12 20:44:34 +03:00
import { getChildDebugElement } from '../../../tests/helpers';
2016-05-09 22:55:16 +03:00
2016-06-12 20:44:34 +03:00
2017-03-30 15:17:08 +03:00
import { OperationsList } from './operations-list';
2016-10-23 20:18:42 +03:00
import { SpecManager } from '../../utils/spec-manager';
2015-12-19 18:19:18 +03:00
2016-12-25 20:15:24 +03:00
describe('Redoc components', () => {
2016-09-02 23:18:31 +03:00
beforeEach(() => {
TestBed.configureTestingModule({ declarations: [ TestAppComponent ] });
});
2017-03-30 15:17:08 +03:00
describe('OperationsList Component', () => {
2015-12-19 20:36:28 +03:00
let builder;
let component;
let fixture;
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], (_specMgr) => {
specMgr = _specMgr;
2016-04-30 00:45:53 +03:00
})));
2016-11-24 16:29:29 +03:00
beforeEach(done => {
2017-03-30 15:17:08 +03:00
specMgr.load('/tests/schemas/operations-list-component.json').then(done, done.fail);
2016-11-24 16:29:29 +03:00
});
2016-07-01 15:53:16 +03:00
beforeEach(() => {
2016-09-02 23:18:31 +03:00
fixture = TestBed.createComponent(TestAppComponent);
2017-03-30 15:17:08 +03:00
component = getChildDebugElement(fixture.debugElement, 'operations-list').componentInstance;
2016-07-01 15:53:16 +03:00
fixture.detectChanges();
2015-12-19 20:36:28 +03:00
});
it('should init component and component data', () => {
expect(component).not.toBeNull();
});
2016-12-25 20:15:24 +03:00
it('should build correct tags list', () => {
expect(component.tags).not.toBeNull();
component.tags.should.have.lengthOf(2);
component.tags[0].name.should.be.equal('traitTag');
2016-12-25 20:15:24 +03:00
should.not.exist(component.tags[0].items);
component.tags[1].name.should.be.equal('tag1');
2016-12-25 20:15:24 +03:00
component.tags[1].items.should.have.lengthOf(2);
2015-12-19 20:36:28 +03:00
});
2015-12-19 18:19:18 +03:00
});
});
@Component({
selector: 'test-app',
2015-12-19 18:19:18 +03:00
template:
2017-03-30 15:17:08 +03:00
`<operations-list></operations-list>`
2015-12-19 18:19:18 +03:00
})
2016-06-13 20:54:24 +03:00
class TestAppComponent {
2015-12-19 18:19:18 +03:00
}