Skip to content

Commit

Permalink
test(RxObservableQuery): chaining (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilkisiela committed Feb 3, 2017
1 parent 66c011a commit 3b494a7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/RxObservableQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { RxObservableQuery } from '../src/RxObservableQuery';
import { ObservableQueryRef } from '../src/utils/ObservableQueryRef';

import 'rxjs/add/operator/map';
import 'rxjs/add/operator/do';

describe('RxObservableQuery', () => {
let obsQuery: ObservableQuery<any>;
Expand Down Expand Up @@ -65,6 +66,29 @@ describe('RxObservableQuery', () => {
},
});
});

it('should be chainable', (done: MochaDone) => {
const counter = { calls: 0 };

function justDoIt() {
counter.calls++;
}

rxObsQuery
.do(justDoIt)
.do(justDoIt)
.do(justDoIt)
.subscribe({
next(result) {
assert.deepEqual(result.data, heroes.data);
assert.equal(counter.calls, 3);
done();
},
error() {
done(new Error('should not be called'));
},
});
});
});

describe('apollo-specific', () => {
Expand Down

0 comments on commit 3b494a7

Please sign in to comment.