Last active
April 19, 2020 21:39
-
-
Save Qarun-Qadir-Bissoondial/90a5509c08b954bf5346c7b1e49d30f2 to your computer and use it in GitHub Desktop.
InventoryService Test file - Main Functionality
This file contains 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
import { TestBed } from '@angular/core/testing'; | |
import { InventoryService } from './inventory.service'; | |
fdescribe('InventoryService', () => { | |
let service: InventoryService; | |
beforeEach(() => { | |
TestBed.configureTestingModule({}); | |
service = TestBed.inject(InventoryService); | |
}); | |
it('should be created', () => { | |
expect(service).toBeTruthy(); | |
}); | |
it('should initialize the count to 0', () => { | |
expect(service.inventoryCount).toBe(0); | |
}) | |
it('should increment the count', () => { | |
expect(service.inventoryCount).toBe(0); | |
service.incrementCount(); | |
expect(service.inventoryCount).toBe(1); | |
}); | |
it('should decrement the count', () => { | |
service.inventoryCount = 10; | |
service.decrementCount(); | |
expect(service.inventoryCount).toBe(9); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment