ToolJet/server/plugins/datasources/graphql/test.spec.ts
Arpit 26c9cc655c
Fix linting errors across the app (#785)
* eslint-setup: rules for frontend and server

* setup pre-commit:hook

* frontend:eslint fixes

* frontend eslint errors and warning fixed

* eslint:fix for ./server

* fix server/test: expectatin string lint/error

* pre-commit:updated

* removed unwanted install cmd from docker file

* recommended settings and extension for vscode

* husky prepare script added

* updated extension recommendations

* added prettier as recommended extension

* added pre-commit to package.json

* remove .prettierrc file

* resolve changes

* resolve changes
2021-09-21 19:18:28 +05:30

28 lines
825 B
TypeScript

import { Test, TestingModule } from '@nestjs/testing';
import GraphqlQueryService from '.';
describe('GraphqlQueryService', () => {
let service: GraphqlQueryService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [GraphqlQueryService],
}).compile();
service = module.get<GraphqlQueryService>(GraphqlQueryService);
});
it('should query graphql datasources', async () => {
const sourceOptions = {
url: 'https://api.spacex.land/graphql/',
headers: [],
url_params: [],
};
const queryOptions = { query: '{ launchesPast(limit: 10) { mission_name } }' };
const result = await service.run(sourceOptions, queryOptions, 'no-datasource-id');
expect(result.data['data']['launchesPast'].length).toBe(10);
});
});