1// Angular - Jasmine
2// Fake a HTTP request
3
4public getSomething() : Observable<any>{
5 let response: DataResult<any> = { data: "something" };
6 return of(response);
7}
1 public static mockGetProfile(){
2 const response = JSON.parse(`
3 "name": "abc",
4 "active": true,
5 ...all other json fields that you want
6 `);
7
8 let obs = new Observable((subscriber) => {
9 setTimeout(()=>{
10 subscriber.next(response);
11 subscriber.complete();
12 }, 3000);
13 });
14 return obs;
15}