As a newcomer to jest, I am diving into testing with this new library. Before me lies the challenge of testing the following method:
public static getProjectBranch(toto: any): string {
if ("branch" in toto) {
return toto.branch;
} else {
return "master";
}
}
This method is nestled inside a class named totoService.ts
In my totoService.spec.ts file, here is what I have done so far :
describe("Test get Project Branch", () => {
test("branch is in component", () => expect(getProjectBranch()).toBe(""));
});
I'm curious to know if my testing approach is on point or not? Additionally, I'm seeking guidance on how to correctly import the getProjectBranch method in the file.