Skip to content

Commit

Permalink
fix(database): Fix test TypeScript errors
Browse files Browse the repository at this point in the history
Closes #875
  • Loading branch information
cartant authored and davideast committed Apr 4, 2017
1 parent 2d80cde commit 750737c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
24 changes: 9 additions & 15 deletions src/database/firebase_list_factory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -759,19 +759,17 @@ describe('FirebaseListFactory', () => {
startAt: { value: 0 }
}
});
query1 = take.call(query1, 1);
query1 = toPromise.call(query1);
let promise1 = toPromise.call(take.call(query1, 1));

let query2 = FirebaseListFactory(`questions`, {
query: {
orderByChild: 'data',
startAt: { value: 0, key: 'val2' }
}
});
query2 = take.call(query2, 1);
query2 = toPromise.call(query2);
let promise2 = toPromise.call(take.call(query2, 1));

Promise.all([query1, query2]).then(([list1, list2]) => {
Promise.all([promise1, promise2]).then(([list1, list2]) => {
expect(list1.map(i => i.$key)).toEqual(['val1', 'val2', 'val3']);
expect(list2.map(i => i.$key)).toEqual(['val2', 'val3']);
done();
Expand Down Expand Up @@ -799,19 +797,17 @@ describe('FirebaseListFactory', () => {
equalTo: { value: 0 }
}
});
query1 = take.call(query1, 1);
query1 = toPromise.call(query1);
let promise1 = toPromise.call(take.call(query1, 1));

let query2 = FirebaseListFactory(`questions`, {
query: {
orderByChild: 'data',
equalTo: { value: 0, key: 'val2' }
}
});
query2 = take.call(query2, 1);
query2 = toPromise.call(query2);
let promise2 = toPromise.call(take.call(query2, 1));

Promise.all([query1, query2]).then(([list1, list2]) => {
Promise.all([promise1, promise2]).then(([list1, list2]) => {
expect(list1.map(i => i.$key)).toEqual(['val1', 'val2', 'val3']);
expect(list2.map(i => i.$key)).toEqual(['val2']);
done();
Expand Down Expand Up @@ -839,19 +835,17 @@ describe('FirebaseListFactory', () => {
endAt: { value: 0 }
}
});
query1 = take.call(query1, 1);
query1 = toPromise.call(query1);
let promise1 = toPromise.call(take.call(query1, 1));

let query2 = FirebaseListFactory(`questions`, {
query: {
orderByChild: 'data',
endAt: { value: 0, key: 'val2' }
}
});
query2 = take.call(query2, 1);
query2 = toPromise.call(query2);
let promise2 = toPromise.call(take.call(query2, 1));

Promise.all([query1, query2]).then(([list1, list2]) => {
Promise.all([promise1, promise2]).then(([list1, list2]) => {
expect(list1.map(i => i.$key)).toEqual(['val1', 'val2', 'val3']);
expect(list2.map(i => i.$key)).toEqual(['val1', 'val2']);
done();
Expand Down
4 changes: 2 additions & 2 deletions src/database/query_observable.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
import { Subject } from 'rxjs/Subject';
import { Query } from '../interfaces';
import { Query, ScalarQuery } from '../interfaces';
import { getOrderObservables, observeQuery } from './index';

function scalarQueryTest(query: Query, done: any) {
function scalarQueryTest(query: ScalarQuery, done: any) {
const queryObservable = observeQuery(query);
queryObservable.subscribe(result => {
expect(result).toEqual(query);
Expand Down

0 comments on commit 750737c

Please sign in to comment.