How to use the faker.random.number function in faker

To help you get started, we’ve selected a few faker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fiverr / passable / src / Enforce / runnables / rules / greater_than / spec.js View on Github external
describe('Arguments are non numeric', () => {
        [random.word(), (`${random.number()}`).split(''), {}].forEach((element) => {
            it('Should return false', () => {
                expect(greaterThan(element, 0)).to.equal(false);
            });
        });
    });
});
github fiverr / passable / src / Enforce / runnables / rules / less_than / spec.js View on Github external
describe('Arguments are non numeric', () => {
        [random.word(), (`${random.number()}`).split(''), {}].forEach((element) => {
            it('Should return false', () => {
                expect(lessThan(element, 0)).to.equal(false);
            });
        });
    });
});
github fiverr / passable / src / Enforce / runnables / rules / equals / spec.js View on Github external
import { expect } from 'chai';
import { random } from 'faker';
import { sample } from 'lodash';
import equals from '.';

const VALUES = [
    random.word(),
    random.number(),
    { [random.objectElement()]: random.word() },
    [random.arrayElement()],
    random.boolean()
];

const LOOSE_PAIRS = [
    [1, '1'],
    [1, true],
    [false, 0],
    [undefined, null]
];

describe('Equals rule', () => {

    it('Should return true for same value', () => {
        VALUES.forEach((value) => expect(equals(value, value)).to.equal(true));
github microsoft / fluent-ui-react / docs / src / prototypes / chatPane / services / dataMock.ts View on Github external
private getRandomUser(max: number = this.usersMap.size - 1): UserData {
    return this.usersMap.get(this.userIds[random.number({ max, precision: 1 })])
  }
}
github Flexget / webui / src / plugins / history / state / fixtures.ts View on Github external
export const makeHistory = (): History => ({
  task: random.words(),
  title: random.words(),
  url: internet.url(),
  filename: system.fileName(),
  details: random.words(),
  time: date.past().toUTCString(),
  id: random.number(100),
});
github manaflair / mylittledom / examples / draggable-windows.example.js View on Github external
@autobind handleClick() {

        let width = 30;
        let height = 4;

        let x = random.number(this.refs.container.elementRect.width - width);
        let y = random.number(this.refs.container.elementRect.height - height);

        this.setState(({ windows }) => {

            let index = windows.length;

            windows = windows.concat([ { x, y, width, height, onDrag: (x, y) => {
                this.handleDrag(index, x, y);
            }, onDelete: () => {
                this.handleDelete(index);
            } } ]);

            return { windows };

        });
github ealush / n4s / src / rules / numberEquals / spec.js View on Github external
beforeEach(() => {
            arg0 = random.number();
        });
github aredotna / ervell / .storybook / mocks.js View on Github external
Image: () => ({
    ...connectable(),
    image_url: generateImage(
      random.number({ min: 200, max: 800 }),
      random.number({ min: 200, max: 800 })
    ),
  }),
github aredotna / ervell / .storybook / mocks.js View on Github external
const connectable = () => ({
  href: `/blocks/${random.number({ min: 1, max: 1000 })}`,
  created_at: `${random.number({ min: 1, max: 10 })} hours ago`,
  updated_at: `${random.number({ min: 1, max: 10 })} hours ago`,
})