I’m having an issue with CORS blocking on my unit test using Jasmine, I understand the
issue but I’m not sure how to fix it. I have handle the CORS issue with my application on the backend everything is fine.
Issue Karma is on http://localhost:9876 and
Angular application is on http://localhost:4200
My unit test services are mocked so there is no real service being used
My application runs with no issues, its the unit testing that give me the error:
I using focus when running my test so there are only 9 test and 1 fails.
I know my product.service.spec completes because of console.log “result verified ”
The product-item.componet.html is the culprit.
I know the issue is in my template. In my research I have found nothing related to my actual issue. I did see something regarding the CLI but it was a different type of issue. Any point in the right direction will be greatly appreciated
Snippet:
product-item.component.html:
<img class=" img-fluid shacker" [src]="productItem.imageUrl" alt="Clothing" />
product Model:
export class Product {
_id:string;
name: string;
size: string;
description: string;
price: number;
imageUrl: string;
static price: Product;
constructor(_id:string, name: string, description="", size:string, price=0,
imageUrl="" ){
this._id=_id;
this.name = name;
this.description = description;
this.price= price;
this.size= size;
this.imageUrl = imageUrl;
}
}