How to use the faker.helpers 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 derrumbe / Spartacus-as-a-Service / app.js View on Github external
require('./routes/routes.js')(app, passport);


app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));


var faker = require('faker');

var randomName = faker.name.findName(); // Rowan Nikolaus
var randomEmail = faker.internet.email(); // Kassandra.Haley@erich.biz
var randomCard = faker.helpers.createCard(); // random contact card containing many properties


console.log(randomName,randomEmail,randomCard);




module.exports = app;
github gaeduron / Matcha / server / postgresql / seed / seedGenerator.js View on Github external
function genUser({ occupations, okcupid, female, male }) {

	const orientation = ["bi", "gay", "straight", "straight", "straight"];
	const P = { latitude: 48.861014, longitude: 2.341155 }; // Paris center
	const R = 1000 * 30; // 1km * xkm

	const { latitude, longitude } = randomLocation.randomCirclePoint(P, R);
	const identity = faker.helpers.contextualCard();
	const guessedGender = gender.guess(identity.name).gender == 'male' ? 'man' : 'woman';


	let user = {
		score: Math.floor(Math.random() * 1000),
		login: identity.username + Math.floor(Math.random() * 1000),
		password: "$2a$10$yb/ec0CAOI4syhgGnFxXe.1DwSC97/93neXjL8ZVuY6qXJJwfmrJ.",
		firstname: identity.name,
		lastname: faker.name.lastName(),
		email: identity.email,
		sex: guessedGender,
		sexualOrientation: pickRand(orientation),
		bio: okcupid[Math.floor(Math.random() * okcupid.length)],
		latitude,
		longitude,
		birthdate: faker.date.between('1977-01-01', '2000-01-01'),
github lykmapipo / bipsms / test / unit / Transport.js View on Github external
it('should be able to parse a given json string safely', function (done) {
    var data = faker.helpers.userCard();
    var dataAsString = JSON.stringify(data);

    var transport = new Transport();
    var dataAsJson = transport._parse(dataAsString);

    expect(dataAsJson).to.eql(data);

    done();
  });
github andersonba / yve-bot / test / mocks.ts View on Github external
() => {
    const word: string = faker.random.word();
    return {
      label: word,
      next: faker.database.column(),
      value: faker.helpers.slugify(word),
    };
  }
);
github flow-typed / flow-typed / definitions / npm / faker_v4.x.x / flow_v0.104.x- / test_faker_v4.x.x.js View on Github external
describe("helpers", () => {
  faker.helpers.randomize([]);
  faker.helpers.slugify("string");
  faker.helpers.replaceSymbolWithNumber("string");
  faker.helpers.replaceSymbolWithNumber("string", "symbol");
  faker.helpers.replaceSymbols("string");
  faker.helpers.shuffle([]);
  faker.helpers.mustache("template", {});
  faker.helpers.createCard();
  faker.helpers.contextualCard();
  faker.helpers.userCard();
  faker.helpers.createTransaction();
});
github blockstack / radiks-server / test / mocks.ts View on Github external
import faker from 'faker';
import getDB from './db';
import constants from '../src/lib/constants';

const userGroupId = faker.random.uuid();

const models = {
  test1: {
    name: faker.name.findName(),
    email: faker.internet.email(),
    info: faker.helpers.createCard(),
    _id: faker.random.uuid(),
  },
  hank: {
    name: 'hank stoever',
    age: 120,
    _id: faker.random.uuid(),
  },
  myla: {
    name: 'Myla',
    age: 4.5,
    _id: faker.random.uuid(),
  },
  notUpdatable: {
    updatable: false,
    _id: faker.random.uuid(),
  },
github UiPath / angular-components / projects / angular / components / ui-grid / src / managers / filter-manager.spec.ts View on Github external
const searchableDropdownToFilterOptionDefinition = (
    column: UiGridColumnDirective,
    searchFilterDefinitions: ISearchableDropdownFilterDefinition[],
): ITestSearchableColumnOptionDefinition => ({
    column,
    option: faker.helpers.randomize(searchFilterDefinitions.find(x => x.dropdown === column.searchableDropdown)!.items),
});
github fluidstackdev / fluidstack / packages / server / prisma / seed.ts View on Github external
return job(n, async () => {
    const productName = faker.commerce.productName()

    const product = await photon.products.create({
      data: {
        name: productName,
        description: faker.random.words(),
        slug: faker.helpers.slugify(productName),
        brand: {
          connect: { id: pickRnd(allBrands).id },
        },
        thumbnail: {
          create: { url: _.sample(IMAGES)! },
        },
        attributes: {
          connect: [{ id: pickRnd(materials).id }, { id: pickRnd(length).id }],
        },
        type: {
          connect: { id: pickRnd(allProductTypes).id },
        },
      },
    })

    const variants = await generateVariant(allOptions)
github Scharkee / react-redux-passport-uikit-express-boiler / src / server / server.js View on Github external
people: Array.apply(null, Array(4)).map(() => {
        return {
          name: faker.name.findName(),
          email: faker.internet.email(),
          contact: faker.helpers.createCard()
        };
      })
    },
github JKHeadley / appy-backend / frontend / src / components / views / main / Main.vue View on Github external
demo () {
      return {
        displayName: faker.name.findName(),
        avatar: faker.image.avatar(),
        email: faker.internet.email(),
        randomCard: faker.helpers.createCard()
      }
    },
    displayName () {