From 90469d59ddeffe599024de423570cf42d190b1ee Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Fri, 16 Nov 2018 15:13:10 +0200 Subject: [PATCH] Enable Flow typings on some of Execution tests --- src/execution/__tests__/abstract-promise-test.js | 10 +++++++++- src/execution/__tests__/lists-test.js | 4 ++-- src/execution/__tests__/resolve-test.js | 4 +++- src/execution/__tests__/union-interface-test.js | 12 +++++++++++- src/execution/__tests__/variables-test.js | 4 ++-- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/execution/__tests__/abstract-promise-test.js b/src/execution/__tests__/abstract-promise-test.js index 3dceefbf38..5de1528609 100644 --- a/src/execution/__tests__/abstract-promise-test.js +++ b/src/execution/__tests__/abstract-promise-test.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @noflow + * @flow strict */ import { expect } from 'chai'; @@ -21,6 +21,9 @@ import { } from '../../'; class Dog { + name: string; + woofs: boolean; + constructor(name, woofs) { this.name = name; this.woofs = woofs; @@ -28,6 +31,9 @@ class Dog { } class Cat { + name: string; + meows: boolean; + constructor(name, meows) { this.name = name; this.meows = meows; @@ -35,6 +41,8 @@ class Cat { } class Human { + name: string; + constructor(name) { this.name = name; } diff --git a/src/execution/__tests__/lists-test.js b/src/execution/__tests__/lists-test.js index d5322ccd9f..feab126922 100644 --- a/src/execution/__tests__/lists-test.js +++ b/src/execution/__tests__/lists-test.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @noflow + * @flow strict */ import { expect } from 'chai'; @@ -76,7 +76,7 @@ describe('Execute: Accepts any iterable as list value', () => { }), ); - function getArgs() { + function getArgs(..._args) { return arguments; } diff --git a/src/execution/__tests__/resolve-test.js b/src/execution/__tests__/resolve-test.js index a143ac8cc2..42312e5278 100644 --- a/src/execution/__tests__/resolve-test.js +++ b/src/execution/__tests__/resolve-test.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @noflow + * @flow strict */ import { expect } from 'chai'; @@ -70,6 +70,8 @@ describe('Execute: resolve function', () => { }); class Adder { + _num: number; + constructor(num) { this._num = num; } diff --git a/src/execution/__tests__/union-interface-test.js b/src/execution/__tests__/union-interface-test.js index 4a4095d762..7dbcc6127c 100644 --- a/src/execution/__tests__/union-interface-test.js +++ b/src/execution/__tests__/union-interface-test.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @noflow + * @flow strict */ import { expect } from 'chai'; @@ -23,6 +23,9 @@ import { } from '../../type'; class Dog { + name: string; + barks: boolean; + constructor(name, barks) { this.name = name; this.barks = barks; @@ -30,6 +33,9 @@ class Dog { } class Cat { + name: string; + meows: boolean; + constructor(name, meows) { this.name = name; this.meows = meows; @@ -37,6 +43,10 @@ class Cat { } class Person { + name: string; + pets: ?Array; + friends: ?Array; + constructor(name, pets, friends) { this.name = name; this.pets = pets; diff --git a/src/execution/__tests__/variables-test.js b/src/execution/__tests__/variables-test.js index 83f08e1080..c5e721185e 100644 --- a/src/execution/__tests__/variables-test.js +++ b/src/execution/__tests__/variables-test.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @noflow + * @flow strict */ import inspect from '../../jsutils/inspect'; @@ -702,7 +702,7 @@ describe('Execute: Handles inputs', () => { ], }); - expect(result.errors[0].originalError).not.to.equal(undefined); + expect(result).to.have.nested.property('errors[0].originalError'); }); it('reports error for non-provided variables for non-nullable inputs', () => {