0

I have a service similar to the below code:

allCustomerList = []

getCustomerList() {

    return new Observable((observer) => {
        const local = localStorage.getItem('customerList');
        this.allCustomerList = local ? JSON.parse(local) : [];
        observer.next(this.allCustomerList);
    })}

getcustomerByEmail(email: string) { return new Observable((observer) => {
 const customer = this.findCustomer(email) observer.next(customer); }) 
}

findCustomer(email: string) {
    return this.allCustomerList.find(x => x.Email === email);`
}

I want to write unit test for this but I cannot. Can you help me to fix it?

Peter David Carter
  • 2,548
  • 8
  • 25
  • 44
abolfazl_mehdi
  • 179
  • 2
  • 12

0 Answers0