-
-
Notifications
You must be signed in to change notification settings - Fork 85
/
editor-container.component.spec.ts
59 lines (53 loc) · 1.79 KB
/
editor-container.component.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MatMenuModule } from '@angular/material/menu';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { CodeGenSettings } from '@app/core/state/page.state';
import { XStore } from '@app/core/state/state.mock';
import { NgxsModule, Store } from '@ngxs/store';
import { CodeGenKind, CodeGenService } from './codegen/codegen.service';
import { EditorContainerComponent } from './editor-container.component';
const codeGenService = {
generate() { return {
content: [],
kind: CodeGenKind.Angular,
buttons: {},
}; }
};
describe('EditorContainerComponent', () => {
let component: EditorContainerComponent;
let fixture: ComponentFixture<EditorContainerComponent>;
let store: Store;
beforeEach(async(() => {
TestBed.configureTestingModule({
schemas: [NO_ERRORS_SCHEMA],
imports: [
NgxsModule.forRoot([XStore]),
MatMenuModule,
MatSnackBarModule
],
providers: [
{
provide: CodeGenService,
useValue: codeGenService
}
],
declarations: [EditorContainerComponent]
}).compileComponents();
store = TestBed.get(Store);
}));
beforeEach(() => {
fixture = TestBed.createComponent(EditorContainerComponent);
component = fixture.componentInstance;
component.codeSetting = {} as CodeGenSettings;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
store.selectOnce(state => state.codegen).subscribe((codegen: CodeGenSettings) => {
expect(codegen.content).toEqual([]);
expect(codegen.kind).toBe(CodeGenKind.Angular);
expect(codegen.buttons.stackblitz).toBeTruthy();
});
});
});