redoc/lib/components/base.spec.ts

41 lines
1.1 KiB
TypeScript
Raw Normal View History

2015-12-12 23:13:26 +03:00
'use strict';
2016-06-22 21:17:48 +03:00
import { SpecManager } from '../utils/SpecManager';
2016-06-12 20:44:34 +03:00
import { BaseComponent } from '../components/base';
2015-12-12 23:13:26 +03:00
2015-12-19 20:36:28 +03:00
describe('Redoc components', () => {
describe('BaseComponent', () => {
let specMgr;
2015-12-19 20:36:28 +03:00
let component;
beforeAll(() => {
specMgr = new SpecManager();
specMgr._schema = {tags: []};
2015-12-12 23:13:26 +03:00
});
2015-12-19 20:36:28 +03:00
beforeEach(() => {
component = new BaseComponent(specMgr);
2015-12-12 23:13:26 +03:00
});
2015-12-19 20:36:28 +03:00
it('should set instance properties', () => {
component.specMgr.should.be.equal(specMgr);
//component.schema.should.be.of.type('object');
2015-12-19 20:36:28 +03:00
expect(component.componentSchema).toBeNull();
});
2015-12-14 11:18:46 +03:00
2015-12-19 20:36:28 +03:00
it('should set componentSchema based on pointer on ngOnInit', () => {
component.pointer = '/tags';
component.ngOnInit();
component.componentSchema.should.be.deepEqual(specMgr._schema.tags);
2015-12-14 11:18:46 +03:00
});
it('should call init virtual methods after init', () => {
2016-06-12 20:44:34 +03:00
spyOn(component, 'init');
2015-12-19 20:36:28 +03:00
component.ngOnInit();
2016-06-12 20:44:34 +03:00
component.init.calls.count().should.be.equal(1);
component.init.and.callThrough();
2015-12-14 11:18:46 +03:00
});
});
2015-12-12 23:13:26 +03:00
});