Skip to content

Commit

Permalink
Add a test that demonstrates issue #354
Browse files Browse the repository at this point in the history
  • Loading branch information
rricard committed Jul 6, 2016
1 parent 2366ba6 commit 95d55d4
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test/QueryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2542,6 +2542,48 @@ describe('QueryManager', () => {
});
});
});

describe('inline fragments', () => {
it('should resolve on union types with inline fragments', (done) => {
const query = gql`
query {
all_people {
name
... on Jedi {
side
}
... on Droid {
model
}
}
}`;
const data = {
all_people: [
{
name: 'Luke Skywalker',
side: 'bright',
},
{
name: 'R2D2',
model: 'astromech',
},
],
};
const queryManager = new QueryManager({
networkInterface: mockNetworkInterface({
request: { query },
result: { data },
}),
store: createApolloStore(),
reduxRootKey: 'apollo',
});

queryManager.fetchQuery('made up id', { query }).then((result) => {
assert.deepEqual(result.data, data);
done();
}).catch(done);
});
});
});

function testDiffing(
Expand Down

0 comments on commit 95d55d4

Please sign in to comment.