Skip to content

Commit

Permalink
[math-random] Add libdefs for math-random (#2922)
Browse files Browse the repository at this point in the history
* [math-random] Add libdefs for math-random

* Fix broken test
  • Loading branch information
102 authored and villesau committed Oct 31, 2018
1 parent 8b4d9bf commit c7e1020
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
@@ -0,0 +1,6 @@
declare module "math-random" {
declare module.exports: {
(): number,
cryptographic: ?boolean
};
}
22 changes: 22 additions & 0 deletions 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);
});
});

0 comments on commit c7e1020

Please sign in to comment.