My functions in Calculator class is private and I can't test in this way,
describe('calculate', function() {
it('add', function() {
let result = Calculator.Sum(5, 2);
expect(result).toBe(7);
});
it('substract', function() {
let result = Calculator.Difference(5, 2);
expect(result).toBe(3);
});
});
my class:
export default class calculator {
private Sum(a: number, b: number): number {
let c = a + b;
return c;
}
private Difference(a: number, b: number): number {
let c = a - b;
return c;
}
}
how can I modify this test with using spyOn on private methods?
thanks for any help