Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/database/list/audit-trail.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('auditTrail', () => {
const { changes } = prepareAuditTrail();
changes.subscribe(actions => {
const data = actions.map(a => a.payload.val());
expect(data).toEqual(items);
expect(data).toEqual([items[items.length - 1]]);
done();
});

Expand Down
4 changes: 1 addition & 3 deletions src/database/list/snapshot-changes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ describe('snapshotChanges', () => {
});

it('should handle dynamic queries that return empty sets', done => {
const ITEMS = 10;
let count = 0;
let firstIndex = 0;
let namefilter$ = new BehaviorSubject<number|null>(null);
const aref = createRef(rando());
aref.set(batch);
Expand All @@ -135,7 +133,7 @@ describe('snapshotChanges', () => {
namefilter$.next(-1);
}
// on the second round, we should have filtered out everything
if(count === 2) {
else if(count === 2) {
expect(Object.keys(data).length).toEqual(0);
}
}).add(done);
Expand Down
2 changes: 1 addition & 1 deletion src/database/list/state-changes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('stateChanges', () => {

it('should listen to all events by default', (done) => {

const { changes } = prepareStateChanges({ skip: 2 });
const { changes } = prepareStateChanges();
changes.subscribe(action => {
expect(action.key).toEqual('2');
expect(action.payload.val()).toEqual(items[items.length - 1]);
Expand Down
10 changes: 3 additions & 7 deletions src/database/observable/fromRef.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,13 @@ describe('fromRef', () => {
const itemRef = ref(rando());
itemRef.set(batch);
const obs = fromRef(itemRef, 'child_added');
let count = 0;
const sub = obs.subscribe(change => {
count = count + 1;
const { type, payload } = change;
expect(type).toEqual('child_added');
expect(payload.val()).toEqual(batch[payload.key!]);
if (count === items.length) {
done();
sub.unsubscribe();
expect(sub.closed).toEqual(true);
}
sub.unsubscribe();
expect(sub.closed).toEqual(true);
done();
});
});

Expand Down
6 changes: 2 additions & 4 deletions src/database/observable/fromRef.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { DatabaseQuery, DatabaseSnapshot, ListenEvent, AngularFireAction } from '../interfaces';
import { Observable } from 'rxjs/Observable';
import { observeOn } from 'rxjs/operator/observeOn';
import { FirebaseZoneScheduler } from 'angularfire2';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/delay';
import 'rxjs/add/operator/debounceTime';
import 'rxjs/add/operator/share';

interface SnapshotPrevKey {
Expand Down Expand Up @@ -37,6 +35,6 @@ export function fromRef(ref: DatabaseQuery, event: ListenEvent, listenType = 'on
// Ensures subscribe on observable is async. This handles
// a quirk in the SDK where on/once callbacks can happen
// synchronously.
.delay(0)
.debounceTime(0)
.share();
}
3 changes: 2 additions & 1 deletion tools/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const GLOBALS = {
'rxjs/add/observable/fromPromise': 'Rx.Observable.prototype',
'rxjs/add/operator/delay': 'Rx.Observable',
'rxjs/add/operator/debounce': 'Rx.Observable',
'rxjs/add/operator/debounceTime': 'Rx.Observable',
'rxjs/add/operator/share': 'Rx.Observable',
'rxjs/observable/fromEvent': 'Rx.Observable',
'rxjs/observable/from': 'Rx.Observable',
Expand Down Expand Up @@ -180,7 +181,7 @@ function generateBundle(entry, { dest, globals, moduleName }) {

function createFirebaseBundles(featurePaths, globals) {
return Object.keys(featurePaths).map(feature => {
return generateBundle(featurePaths[feature], {
return generateBundle(featurePaths[feature], {
dest: `${process.cwd()}/dist/bundles/${feature}.js`,
globals,
moduleName: `firebase.${feature}`
Expand Down