angular jasmine mock http request
// Angular - Jasmine
// Fake a HTTP request
public getSomething() : Observable<any>{
let response: DataResult<any> = { data: "something" };
return of(response);
}
angular jasmine mock http request
// Angular - Jasmine
// Fake a HTTP request
public getSomething() : Observable<any>{
let response: DataResult<any> = { data: "something" };
return of(response);
}
angular jasmin mock http response
public static mockGetProfile(){
const response = JSON.parse(`
"name": "abc",
"active": true,
...all other json fields that you want
`);
let obs = new Observable((subscriber) => {
setTimeout(()=>{
subscriber.next(response);
subscriber.complete();
}, 3000);
});
return obs;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us