call private method using square brackets
Ts file
class Calculate{
private total;
private add(a: number) {
return a + total;
}
}
spect.ts file
it('should return 5 if input 3 and 2', () => {
component['total'] = 2;
let result = component['add'](3);
expect(result).toEqual(5);
});