Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Commit

Permalink
test(list): change tests to match refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
adriancarriger committed May 20, 2017
1 parent 57873d5 commit e6ec4a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
9 changes: 5 additions & 4 deletions src/database/database.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { AngularFireDatabase } from 'angularfire2/database';
import { Subject } from 'rxjs/Rx';

import { AfoListObservable } from './list/afo-list-observable';
import { InternalListObservable } from './list/internal-list-observable';
import { AfoObjectObservable } from './object/afo-object-observable';
import { AngularFireOfflineDatabase } from './database';
import { LocalForageToken } from './offline-storage/localforage';
Expand Down Expand Up @@ -270,7 +271,7 @@ describe('Service: AngularFireOfflineDatabase', () => {
service.listCache[key] = {
loaded: false,
offlineInit: false,
sub: new MockAfoListObservable()
sub: new MockInternalListObservable()
};
service.processing.current = true;
setTimeout(() => {
Expand Down Expand Up @@ -413,7 +414,7 @@ describe('Service: AngularFireOfflineDatabase', () => {
service.listCache['items'] = {
loaded: false,
offlineInit: false,
sub: new MockAfoListObservable()
sub: new MockInternalListObservable()
};
service.processing.listCache['items'] = ['item-1', 'item-2'];
service.listCache['items'].sub.subscribe(x => testResults.items = x);
Expand Down Expand Up @@ -469,7 +470,7 @@ describe('Service: AngularFireOfflineDatabase', () => {

afoList.complete();

expect((<any>afoList).ref.observers.length).toBe(0);
expect(afoList.observers.length).toBe(0);
setTimeout(done);
})();
});
Expand Down Expand Up @@ -595,7 +596,7 @@ export class MockFirebaseObjectObservable<T> extends Subject<T> {
}
}

export class MockAfoListObservable<T> extends AfoListObservable<T> {
export class MockInternalListObservable<T> extends InternalListObservable<T> {
history = [];
constructor() {
super(Ref, null);
Expand Down
8 changes: 0 additions & 8 deletions src/database/list/internal-list-observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ export class InternalListObservable<T> extends ReplaySubject<T> {
this.updated++;
}
}
/**
* Unsubscribes from child observables first, followed by the default ReplaySubject unsubscribe
*/
unsubscribe() {
this.isStopped = true;
this.closed = true;
this.observers = null;
}
/**
* Wraps the AngularFire2 FirebaseListObservable [push](https://goo.gl/nTe7C0) method
*
Expand Down

0 comments on commit e6ec4a4

Please sign in to comment.