mercredi 2 décembre 2015

Unit tests for firebase - files not included issue

Unit tests for firebase - files not included issue. I'm having trouble getting the unit test running.

The test code seems fine, but it seems some files are missing?

I'm using typescript instead of basic JavaScript for my code

This is what I'm testing:

 export class AppComponent {
     ref: Firebase;
     refUsers: Firebase;
     refProfiles: Firebase;

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

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

         });
     }
 }

This is my current test:

 import {it, iit, describe, expect, inject, injectAsync, beforeEachProviders, fakeAsync, tick } from 'angular2/testing';
 import { AppComponent } from '../app/app';

 describe('AppComponent', () => {

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

         let service = new AppComponent();

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

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

 });

This is the error I'm getting when I run that test:

enter image description here

Aucun commentaire:

Enregistrer un commentaire