I have developed a basic Angular project for managing employee data and I'm looking to test the addProduct
function. Can someone guide me on how to write a test case for this scenario? I am not using a service, just a simple push operation. Any assistance would be greatly appreciated.
public products = [{
name:"iPhone 12",
quantity:5
},
{
name:"Samsung TV",
quantity:1
}];
addProduct(name: string,quantity:number) {
var item = {name:name, quantity:quantity};
this.products.push(item);
}