jeudi 3 décembre 2015

Firebase unit test error - Cannot parse Firebase url

Firebase unit test error - Cannot parse Firebase url.

I'm trying to get the test to run correctly. My test code seems fine but it doesn't like the Firebase usage in the code.

Here is my code I'm testing:

 export class FirebaseService {
   refUsers: Firebase;

   constructor() {
     this.refUsers = new Firebase("http://ift.tt/1Ip9OwM");
   }

   public addUser(newUser: Object): void{    
     this.refUsers.push(newUser, ()=>{     
     });
   }
 }

Here is my unit test:

 import { FirebaseService } from '../app/firebase-service';

 describe('FirebaseService', () => {

     it('saves an item to Firebase', () => {
         var refUsers = new Firebase('');
         var service = new FirebaseService();

         spyOn(service.refUsers, 'push');
         service.addUser({ item: true });

         expect(service.refUsers.push).toHaveBeenCalled();
     })

 });

This is the error message:

enter image description here

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire