-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic.component.spec.ts
37 lines (31 loc) · 997 Bytes
/
basic.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
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { storeTestingFactory } from '@gernsdorfer/ngrx-lite/testing';
import { BasicComponent } from './basic.component';
describe('BasicExampleComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [],
providers: [storeTestingFactory()],
schemas: [NO_ERRORS_SCHEMA],
}).compileComponents();
});
const getComponent = (): BasicComponent => {
const fixture = TestBed.createComponent(BasicComponent);
const component = fixture.componentInstance;
fixture.detectChanges();
return component;
};
it('should be defined', () => {
expect(getComponent()).toBeDefined();
});
describe('increment', () => {
it('should increment state', () => {
const component = getComponent();
component.increment(2);
expect(component.counterState()).toEqual({
counter: 2,
});
});
});
});