Answers for "angular jasmine TypeError: Cannot read property 'pipe' of undefined"

1

angular jasmine TypeError: Cannot read property 'pipe' of undefined

// Angular - Jasmine
// You have to mock the method and fake a HTTP request

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;
}
Posted by: Guest on August-19-2021

Code answers related to "angular jasmine TypeError: Cannot read property 'pipe' of undefined"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language