In my ANGULAR 2 application there is a service; that contains a static reference property.
export class MyService {
public static OneProperty: ClassA;
}
And here is a sample implementation of the method I am going to test in my ts file.
export class TestComponent() {
oneProperty: User;
public NumberOfUsers(): string {
this.oneProperty = MyService.OneProperty.someThing;
return this.oneProperty;
}
}
How can I mock the data in the static variable for the test cases? Whenever I try to mock the data in useClass/useValue format, I am getting a undefined value for MyService.OneProperty.