karma-jasmine
, for example, to get the describe/it
APIs, but you don't necessarily have to install Jasmine specifically. 👉 https://jasmine.github.io
npm ls karma-chai
or npm ls karma-jasmine
to see if they are installed in your project.
karma-jasmine
?
//function...
case 0:
//calling the service here should return 'Sunday' in the appropiate language (this works)
//I want to build a mock in my test for this: this.lang["core.shared.pipes.weekdays.sunday"]
return this.lang["core.shared.pipes.weekdays.sunday"];
}
}
get lang() : string {
return this.language.lang;
}
constructor(private language: AppLanguageService) {}
let mockLanguageService;
beforeEach(() => {
mockLanguageService = jasmine.createSpyObj(['lang'])
TestBed.configureTestingModule({
imports: [],
declarations: [],
providers: [
{provide: AppLanguageService, useValue: mockLanguageService},
]
});
// this is wrong, how do I do this correctly?:
mockLanguageService.lang.and.returnValue({
['core.shared.pipes.weekdays.monday']: "monday",
['core.shared.pipes.weekdays.tuesday']: "tuesday",
// ...
});
})
I have question in stack overflow for karma this is the first time iam using jasmine and karma
can some one please help me I am struggling lot
https://stackoverflow.com/questions/59704920/issue-in-karma-coverage-html-coverage-report-is-empy