I have the following code in main typescript file:
public readonly funcname = async (
param: string): Promise<CustomeType> => {
const constname = somefunction(strparam, jsonparam);
return Promise.resolve({
reqname:constname
});
};
This is written under an exported class say exportedservice.
I am writing the following testcase in jest for same:
const outputMock = jest.fn(()=>{
return Promise.reject()
});
const exportedserviceobj = new exportedservice()
describe("Statement", () => {
it("statement", async () => {
expect.assertions(1);
const outputResult = await exportedserviceobj.funcname("TestFile")
outputMock().then(outputResult);
expect(outputResult).tobeEqual("undefined")
});
});
while running the test case; it is throwing a type error:
exportedservice.funcname is not a function
As I am new to typescript; so after a lot of R&D; I am unable to resolve the issue. Please suggest appropriate way to solve this out. Thanks in Advance.
Aucun commentaire:
Enregistrer un commentaire