2016-06-10 17:05:39 -07:00
|
|
|
import {
|
2016-06-13 15:27:08 -07:00
|
|
|
expect,
|
2016-06-10 17:05:39 -07:00
|
|
|
} from 'chai';
|
|
|
|
|
2016-06-10 20:48:21 -04:00
|
|
|
// XXX can be removed after tests are actually writen
|
|
|
|
/* tslint:disable:no-unused-variable */
|
2016-06-10 17:05:39 -07:00
|
|
|
import {
|
|
|
|
GraphQLSchema,
|
|
|
|
GraphQLObjectType,
|
2016-06-10 20:48:21 -04:00
|
|
|
GraphQLString,
|
2016-06-10 17:05:39 -07:00
|
|
|
} from 'graphql';
|
|
|
|
|
|
|
|
import { runQuery } from './runQuery';
|
|
|
|
|
|
|
|
const QueryType = new GraphQLObjectType({
|
|
|
|
name: 'QueryType',
|
|
|
|
fields: {
|
|
|
|
testString: {
|
|
|
|
type: GraphQLString,
|
2016-06-10 20:48:21 -04:00
|
|
|
resolve() {
|
2016-06-10 17:05:39 -07:00
|
|
|
return 'it works';
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const Schema = new GraphQLSchema({
|
|
|
|
query: QueryType,
|
|
|
|
});
|
2016-06-10 20:48:21 -04:00
|
|
|
// XXX can be removed after tests are actually writen
|
|
|
|
/* tslint:enable:no-unused-variable */
|
2016-06-10 17:05:39 -07:00
|
|
|
|
|
|
|
describe('runQuery', () => {
|
2016-06-10 20:48:21 -04:00
|
|
|
it('returns a response', () => {
|
|
|
|
// XXX can be removed after tests are actually writen
|
|
|
|
// tslint:disable-next-line:no-unused-variable
|
2016-06-10 17:05:39 -07:00
|
|
|
const query = `{ testString }`;
|
2016-06-13 15:27:08 -07:00
|
|
|
const expected = { testString: 'it works' };
|
|
|
|
return runQuery({ schema: Schema, query: query }).then((res) => {
|
|
|
|
return expect(res.data).to.deep.equal(expected);
|
|
|
|
});
|
2016-06-10 17:05:39 -07:00
|
|
|
});
|
2016-06-10 20:48:21 -04:00
|
|
|
});
|