I have these functions in my Typescript application:
getDocStatus(p: string): Promise<boolean> {
return Api.getData(this.apiUrl + this.checkDoc + p).then(
(response) => response.data
);
}
getExpired(p: string): Promise<boolean> {
return Api.getData(this.apiUrl + this.checkExpired + p).then(
(response) => response.data
);
}
async getButtonStatus(p: string) {
const docStatus = this.getDocStatus(p);
const expiredStatus = this.getExpired(p);
if (await docStatus === Boolean(false) && await expiredStatus === Boolean(false)) {
return false;
} else {
return true;
}
}
I'm now trying to write a test for getButtonStatus. In the test I want to mock response values for getDocStatus and getExpired. How can I do that?