Created
September 10, 2018 09:55
-
-
Save RayLuxembourg/f0529bd138848b13845f6ff5d6b8b222 to your computer and use it in GitHub Desktop.
Simple counter test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('CounterComponent', () => { | |
let component: CounterComponent; | |
let fixture: ComponentFixture<CounterComponent>; | |
beforeEach(async(() => { | |
TestBed.configureTestingModule({ | |
declarations: [CounterComponent] | |
}).compileComponents(); | |
})); | |
beforeEach(() => { | |
fixture = TestBed.createComponent(CounterComponent); | |
component = fixture.componentInstance; | |
fixture.detectChanges(); | |
}); | |
it('should increment', () => { | |
component.count(); | |
expect(component.counts).toBe(1); | |
component.count(); | |
expect(component.counts).toBe(2); | |
}); | |
it('should decrement', () => { | |
component.counts = 5; | |
component.subtruct(); | |
expect(component.counts).toBe(4); | |
component.subtruct(); | |
expect(component.counts).toBe(3); | |
}); | |
it('should reset', () => { | |
component.counts = 5; | |
component.subtruct(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment