I have a method in the test.ts file:
public async listComponentsDiffer(lastTag: string, workDir: string): Promise<any[]>
This method returns an array with data like this:
[{ components: "toto", newVersion: "2", oldVersion: "1" }]
I am attempting to use Jest to test this method:
test("correct array format", () => {
// Given
const lastag = "";
const workDir = ".";
// When
const result = ComponentsService.listComponentsDiffer(lastag, workDir);
// Then
const expected = [{ components: "toto", newVersion: "2", oldVersion: "1" }];
expect(result).toBe(expected);
});
However, I am encountering the following error:
TypeError: test_1.test.listComponentsDiffer is not a function in Jest
How can I properly run my test?