Skip to content

Commit

Permalink
Update all dependencies 🌴 (ardatan#94)
Browse files Browse the repository at this point in the history
* chore(package): update dependencies

https://greenkeeper.io/

* Update package.json

* Run lint after tests

* fix all the linter errors from new airbnb config
  • Loading branch information
greenkeeperio-bot authored and helfer committed Aug 5, 2016
1 parent d8ae842 commit c6a8858
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 42 deletions.
7 changes: 5 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"no-underscore-dangle": 0,
"no-console": 0,
"no-use-before-define": 0,
"no-unused-vars": 0
"no-unused-vars": 0,
"import/prefer-default-export": 0,
"no-mixed-operators": 0,
"import/no-extraneous-dependencies": 0
}
}
}
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test": "test"
},
"scripts": {
"test": "npm run lint && istanbul cover ./node_modules/mocha/bin/_mocha -- --reporter spec --full-trace test/index.js",
"test": "istanbul cover ./node_modules/mocha/bin/_mocha -- --reporter spec --full-trace test/index.js && npm run lint",
"lint": "eslint .",
"testonly": "mocha test/index.js",
"prepublish": "rm -rf ./dist && babel ./src --ignore test --out-dir ./dist"
Expand Down Expand Up @@ -48,23 +48,23 @@
"body-parser": "^1.15.0",
"chai": "^3.5.0",
"dataloader": "^1.1.0",
"eslint": "^2.4.0",
"eslint-config-airbnb": "^9.0.1",
"eslint": "^3.2.2",
"eslint-config-airbnb": "^10.0.0",
"eslint-plugin-import": "^1.1.0",
"eslint-plugin-jsx-a11y": "^1.4.2",
"eslint-plugin-react": "^5.1.1",
"eslint-plugin-jsx-a11y": "^2.0.1",
"eslint-plugin-react": "^6.0.0",
"express": "^4.13.4",
"express3": "0.0.0",
"fs": "0.0.2",
"graphql": "^0.6.0",
"istanbul": "1.0.0-alpha.2",
"lodash": "^4.10.0",
"mocha": "^2.3.3",
"mocha": "^3.0.1",
"multer": "^1.0.3",
"nodemon": "^1.9.1",
"request": "^2.72.0",
"request-promise": "^3.0.0",
"supertest": "^1.0.1",
"request-promise": "^4.1.0",
"supertest": "^2.0.0",
"supertest-as-promised": "^3.1.0",
"webpack": "^1.13.1"
}
Expand Down
4 changes: 2 additions & 2 deletions src/mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function addMockFunctionsToSchema({ schema, mocks = {}, preserveResolvers = fals

const defaultMockMap = new Map();
defaultMockMap.set('Int', () => Math.round(Math.random() * 200) - 100);
defaultMockMap.set('Float', () => Math.random() * 200 - 100);
defaultMockMap.set('Float', () => (Math.random() * 200) - 100);
defaultMockMap.set('String', () => 'Hello World');
defaultMockMap.set('Boolean', () => Math.random() > 0.5);
defaultMockMap.set('ID', () => uuid.v4());
Expand Down Expand Up @@ -204,7 +204,7 @@ class MockList {

mock(root, args, context, info, fieldType, mockTypeFunc) {
function randint(low, high) {
return Math.floor(Math.random() * (high - low + 1) + low);
return Math.floor((Math.random() * ((high - low) + 1)) + low);
}
let arr;
if (Array.isArray(this.len)) {
Expand Down
13 changes: 6 additions & 7 deletions src/schemaGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function SchemaError(message) {
Error.captureStackTrace(this, this.constructor);
this.message = message;
}
// eslint-disable-next-line new-parens
SchemaError.prototype = new Error;

function generateSchema(...args) {
Expand Down Expand Up @@ -99,13 +100,11 @@ function concatenateTypeDefs(typeDefinitionsAry, functionsCalled = {}) {
concatenateTypeDefs(typeDef(), functionsCalled)
);
}
} else if (typeof typeDef === 'string') {
resolvedTypeDefinitions.push(typeDef.trim());
} else {
if (typeof typeDef === 'string') {
resolvedTypeDefinitions.push(typeDef.trim());
} else {
const type = typeof typeDef;
throw new SchemaError(`typeDef array must contain only strings and functions, got ${type}`);
}
const type = typeof typeDef;
throw new SchemaError(`typeDef array must contain only strings and functions, got ${type}`);
}
});
return uniq(resolvedTypeDefinitions.map((x) => x.trim())).join('\n');
Expand All @@ -115,7 +114,7 @@ function buildSchemaFromTypeDefinitions(typeDefinitions) {
// TODO: accept only array here, otherwise interfaces get confusing.
let myDefinitions = typeDefinitions;
if (typeof myDefinitions !== 'string') {
if (! Array.isArray(myDefinitions)) {
if (!Array.isArray(myDefinitions)) {
// TODO improve error message and say what type was actually found
throw new SchemaError('`typeDefinitions` must be a string or array');
}
Expand Down
1 change: 1 addition & 0 deletions test/circularSchemaA.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import TypeB from './circularSchemaB';

export default () => [`
type TypeA {
id: ID
Expand Down
1 change: 1 addition & 0 deletions test/circularSchemaB.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import TypeA from './circularSchemaA';

export default () => [`
type TypeB {
id: ID
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ require('babel-core/register');
require('babel-polyfill');

// The tests, however, can and should be written with ECMAScript 2015.
require('./tests.js');
require('./tests');
2 changes: 1 addition & 1 deletion test/testDiscourseSchema.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readFile } from 'fs';
import { makeExecutableSchema } from '../src/schemaGenerator.js';
import { assert } from 'chai';
import { graphql } from 'graphql';
import { makeExecutableSchema } from '../src/schemaGenerator.js';
import resolveFunctions from './discourse-api/schema.js';


Expand Down
3 changes: 2 additions & 1 deletion test/testLogger.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { makeExecutableSchema } from '../src/schemaGenerator.js';
import { assert } from 'chai';
import { graphql } from 'graphql';
import { Logger } from '../src/Logger.js';
import { makeExecutableSchema } from '../src/schemaGenerator.js';


describe('Logger', () => {
it('logs the errors', (done) => {
Expand Down
8 changes: 4 additions & 4 deletions test/testMocking.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { expect } from 'chai';
import {
graphql,
} from 'graphql';
import {
addMockFunctionsToSchema,
MockList,
Expand All @@ -7,10 +11,6 @@ import {
buildSchemaFromTypeDefinitions,
addResolveFunctionsToSchema,
} from '../src/schemaGenerator';
import { expect } from 'chai';
import {
graphql,
} from 'graphql';

describe('Mock', () => {
const shorthand = `
Expand Down
38 changes: 22 additions & 16 deletions test/testSchemaGenerator.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
// TODO: reduce code repetition in this file.
// see https://github.com/apollostack/graphql-tools/issues/26


import { assert, expect } from 'chai';
import {
graphql,
GraphQLInt,
GraphQLObjectType,
GraphQLSchema,
} from 'graphql';
import { printSchema } from 'graphql/utilities';
import { Logger } from '../src/Logger.js';
import TypeA from './circularSchemaA';
import {
makeExecutableSchema,
SchemaError,
Expand All @@ -10,11 +19,6 @@ import {
attachConnectorsToContext,
assertResolveFunctionsPresent,
} from '../src/schemaGenerator.js';
import { assert, expect } from 'chai';
import { graphql, GraphQLInt, GraphQLObjectType, GraphQLSchema } from 'graphql';
import { printSchema } from 'graphql/utilities';
import { Logger } from '../src/Logger.js';
import TypeA from './circularSchemaA';


const testSchema = `
Expand Down Expand Up @@ -85,7 +89,7 @@ describe('generating schema from shorthand', () => {
}), SchemaError);
});

it('can generate a schema', (done) => {
it('can generate a schema', () => {
const shorthand = `
type BirdSpecies {
name: String!,
Expand Down Expand Up @@ -204,10 +208,9 @@ describe('generating schema from shorthand', () => {

const jsSchema = makeExecutableSchema({ typeDefs: shorthand, resolvers: resolve });
const resultPromise = graphql(jsSchema, introspectionQuery);
return resultPromise.then((result) => {
assert.deepEqual(result, solution);
done();
});
return resultPromise.then(result =>
assert.deepEqual(result, solution)
);
});

it('can generate a schema from an array of types', () => {
Expand Down Expand Up @@ -275,11 +278,14 @@ describe('generating schema from shorthand', () => {
}
`, TypeA];

const jsSchema = makeExecutableSchema({ typeDefs: typeDefAry, resolvers: {
Query: { foo: () => null },
TypeA: { b: () => null },
TypeB: { a: () => null },
} });
const jsSchema = makeExecutableSchema({
typeDefs: typeDefAry,
resolvers: {
Query: { foo: () => null },
TypeA: { b: () => null },
TypeB: { a: () => null },
},
});
expect(jsSchema.getQueryType().name).to.equal('Query');
});

Expand Down

0 comments on commit c6a8858

Please sign in to comment.