Skip to content

Commit

Permalink
Fix up problems with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Jun 27, 2016
1 parent aa7d9c3 commit 0bef530
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ describe('client', () => {
});
});

describe.only('forceFetch', () => {
describe('forceFetch', () => {
const query = gql`
query number {
myNumber {
Expand Down Expand Up @@ -916,7 +916,7 @@ describe('client', () => {

afterEach(() => {
if (clock) {
clock.reset();
clock.restore();
}
});

Expand Down
5 changes: 3 additions & 2 deletions test/mocks/mockNetworkInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,13 @@ export class MockNetworkInterface implements NetworkInterface {
};

const key = requestToKey(parsedRequest);
const responses = this.mockedResponsesByKey[key];

if (!this.mockedResponsesByKey[key]) {
if (!responses || responses.length === 0) {
throw new Error('No more mocked responses for the query: ' + request.query);
}

const { result, error, delay } = this.mockedResponsesByKey[key].shift();
const { result, error, delay } = responses.shift();

if (!result && !error) {
throw new Error(`Mocked response should contain either result or error: ${key}`);
Expand Down

0 comments on commit 0bef530

Please sign in to comment.