Reputation: 1363
I'm using angular 15 and I have a function in a utility file e.g. in utilities.ts
export function formatInput(value): string {
.....
return string;
}
I'm using this function in the component file like
onInput(event) {
const a = formatInput(event.target.value);
}
I need to write a unit test case for this. Here they are using ts mockito. so I followed https://github.com/johanblumenberg/ts-mockito/commit/5171b536ba52d3e5d34479965fb95880bff0df4b#diff-d8624b09f6455de8932758dd7115df052224c387dcbef07870d4b814bf860c9b I tried like
it('should call the formatInput', () => {
const _spy = spy(formatInput);
component.onInput(....);
verify(_spy).called(); // replaced called() with once() also
});
But it is returning me the error. Could someone help me to fix this, please? I appreciate any help you can provide.
Upvotes: 0
Views: 56