mirror of
https://github.com/Redocly/redoc.git
synced 2025-01-31 01:54:08 +03:00
Very basic redoc component test
This commit is contained in:
parent
69fea61ef0
commit
50d9213c6e
47
lib/components/Redoc/redoc.spec.js
Normal file
47
lib/components/Redoc/redoc.spec.js
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import { getChildDebugElement } from 'tests/helpers';
|
||||||
|
import {Component, View, provide} from 'angular2/core';
|
||||||
|
|
||||||
|
import {
|
||||||
|
TestComponentBuilder,
|
||||||
|
injectAsync,
|
||||||
|
beforeEach,
|
||||||
|
beforeEachProviders,
|
||||||
|
it
|
||||||
|
} from 'angular2/testing';
|
||||||
|
|
||||||
|
import Redoc from 'lib/components/Redoc/redoc';
|
||||||
|
import SchemaManager from 'lib/utils/SchemaManager';
|
||||||
|
|
||||||
|
|
||||||
|
describe('Redoc Component', () => {
|
||||||
|
let builder;
|
||||||
|
beforeEachProviders(() => [
|
||||||
|
provide(SchemaManager, {useValue: new SchemaManager()})
|
||||||
|
]);
|
||||||
|
beforeEach(injectAsync([TestComponentBuilder, SchemaManager], (tcb, schemaMgr) => {
|
||||||
|
builder = tcb;
|
||||||
|
return schemaMgr.load('/tests/schemas/extended-petstore.json').then(() => null, (err) => { throw err; });
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
it('should init component', (done) => {
|
||||||
|
builder.createAsync(TestApp).then(fixture => {
|
||||||
|
let component = getChildDebugElement(fixture.debugElement, 'redoc').componentInstance;
|
||||||
|
expect(component).not.toBeNull();
|
||||||
|
done();
|
||||||
|
}, err => done.fail(err));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/** Test component that contains an MdButton. */
|
||||||
|
@Component({selector: 'test-app'})
|
||||||
|
@View({
|
||||||
|
directives: [Redoc],
|
||||||
|
template:
|
||||||
|
`<redoc></redoc>`
|
||||||
|
})
|
||||||
|
class TestApp {
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user