increase test coverage in operationStore

This commit is contained in:
Jonas Helfer 2016-07-29 12:16:58 -07:00
parent b2279fd9f0
commit 11c6baf20a

View file

@ -18,27 +18,27 @@ const QueryType = new GraphQLObjectType({
fields: {
testString: {
type: GraphQLString,
resolve() {
/*resolve() {
return 'it works';
},
},*/
},
testRootValue: {
type: GraphQLString,
resolve(root) {
/*resolve(root) {
return root + ' works';
},
},*/
},
testContextValue: {
type: GraphQLString,
resolve(root, args, context) {
/*resolve(root, args, context) {
return context + ' works';
},
},*/
},
testArgumentValue: {
type: GraphQLInt,
resolve(root, args, context) {
/*resolve(root, args, context) {
return args['base'] + 5;
},
},*/
args: {
base: { type: new GraphQLNonNull(GraphQLInt) },
},
@ -61,6 +61,16 @@ describe('operationStore', () => {
return expect(print(store.get('testquery'))).to.deep.equal(expected);
});
it('can store queries and return them with getMap', () => {
const query = `query testquery{ testString }`;
const query2 = `query testquery2{ testRootValue }`;
const store = new OperationStore(Schema);
store.put(query);
store.put(query2);
return expect(store.getMap().size).to.equal(2);
});
it('throws a parse error if the query is invalid', () => {
const query = `query testquery{ testString`;