Поскольку ваш метод getProjectBranch
- это stati c, вы можете просто сделать, как показано ниже:
describe("TotoService",() => {
describe('getProjectBranch', () => {
test("branch is in component",() => {
const toto = {branch:''}; //create your test object here
expect(totoService.getProjectBranch(toto)).toEqual(''); //call static method of TotoService
})
})
})
Если вы хотите вызывать не stati c методы, вам нужно создать экземпляр тест totoService beforeEach
:
describe("TotoService",() => {
let totoService;
beforeEach(() => {
totoService = new TotoService();
})
describe('getProjectBranch', () => {
test("branch is in component",() => {
const toto = {branch:''};
expect(totoService.getProjectBranch(toto)).toEqual('');
})
})
})