From c7e1020e4c2cec0b2679ceb9fc6d52eb0a2d05f8 Mon Sep 17 00:00:00 2001 From: Roman Gusev Date: Thu, 1 Nov 2018 02:04:03 +0600 Subject: [PATCH] [math-random] Add libdefs for math-random (#2922) * [math-random] Add libdefs for math-random * Fix broken test --- .../flow_v0.82.x-/math-random_v1.x.x.js | 6 +++++ .../test_math-random_v1.x.x.js | 22 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 definitions/npm/math-random_v1.x.x/flow_v0.82.x-/math-random_v1.x.x.js create mode 100644 definitions/npm/math-random_v1.x.x/test_math-random_v1.x.x.js diff --git a/definitions/npm/math-random_v1.x.x/flow_v0.82.x-/math-random_v1.x.x.js b/definitions/npm/math-random_v1.x.x/flow_v0.82.x-/math-random_v1.x.x.js new file mode 100644 index 0000000000..2eceb46491 --- /dev/null +++ b/definitions/npm/math-random_v1.x.x/flow_v0.82.x-/math-random_v1.x.x.js @@ -0,0 +1,6 @@ +declare module "math-random" { + declare module.exports: { + (): number, + cryptographic: ?boolean + }; +} diff --git a/definitions/npm/math-random_v1.x.x/test_math-random_v1.x.x.js b/definitions/npm/math-random_v1.x.x/test_math-random_v1.x.x.js new file mode 100644 index 0000000000..2e9f3700ad --- /dev/null +++ b/definitions/npm/math-random_v1.x.x/test_math-random_v1.x.x.js @@ -0,0 +1,22 @@ +// @flow + +import { describe, it } from "flow-typed-test"; +import random from "math-random"; + +describe("math-random", () => { + it("does not expect any arguments", () => { + random(); + // $ExpectError + random(null); + // $ExpectError + random({}); + // $ExpectError + random("test"); + // $ExpectError + random(5); + }); + + it('provides a property to check if random is "cryptographic"', () => { + (random.cryptographic: ?boolean); + }); +});