Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-query-generator

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-query-generator - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

2

package.json
{
"name": "graphql-query-generator",
"version": "0.5.0",
"version": "0.5.1",
"description": "Generates queries from the GraphQL endpoint via schema introspection.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -56,3 +56,3 @@ [![build](https://api.travis-ci.org/opentable/graphql-query-generator.svg?branch=master)](https://travis-ci.org/opentable/graphql-query-generator)

const queryGenerator = new QueryGenerator(serverUrl);
queries = queryGenerator.run();
queryPromise = queryGenerator.run();
});

@@ -63,4 +63,8 @@

return queries
.then(queries => Promise.all(queries.map(query => requestToGraphQL(serverUrl, query))))
return queryPromise
.then(({queries, coverage}) =>{
console.log(`Coverage: ${coverage.coverageRatio}`);
console.log(`skipped fields: ${coverage.notCoveredFields}`);
return Promise.all(queries.map(query => requestToGraphQL(serverUrl, query)));
})
.then(results => assert.equal(results.filter(x => x.statusCode !== 200).length, 0));

@@ -67,0 +71,0 @@ });

@@ -1,5 +0,51 @@

var t = require('./testHelper');
// var t = require('./testHelper');
f1(2);
// t.f1(2) // success
// t.f2(2) // Error: f2 is not e function
// f1(2);
// // t.f1(2) // success
// // t.f2(2) // Error: f2 is not e function
const QueryGenerator = require('graphql-query-generator');
const request = require('request');
const assert = require('assert');
describe('Query generation', function() {
const serverUrl = 'http://localhost:12345/graphql';
let queryPromise = null;
before(() => {
const queryGenerator = new QueryGenerator(serverUrl);
queryPromise = queryGenerator.run();
});
it('Generates multiple queries', function() {
this.timeout = 50000;
return queryPromise
.then(({queries, coverage}) =>{
console.log(`Coverage: ${coverage.coverageRatio}`);
console.log(`skipped fields: ${coverage.notCoveredFields}`);
return Promise.all(queries.map(query => requestToGraphQL(serverUrl, query)));
})
.then(results => assert.equal(results.filter(x => x.statusCode !== 200).length, 0));
});
});
function requestToGraphQL(serverUrl, query) {
return new Promise((resolve, reject) => {
request(serverUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body:JSON.stringify({
"query": query,
"variables": "{}",
"operationName": null
})
}, function (err, result) {
if (err) return reject(err);
resolve(result)
});
});
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc