Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
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'),
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();
});
() => {
const word: string = faker.random.word();
return {
label: word,
next: faker.database.column(),
value: faker.helpers.slugify(word),
};
}
);
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();
});
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(),
},
const searchableDropdownToFilterOptionDefinition = (
column: UiGridColumnDirective,
searchFilterDefinitions: ISearchableDropdownFilterDefinition[],
): ITestSearchableColumnOptionDefinition => ({
column,
option: faker.helpers.randomize(searchFilterDefinitions.find(x => x.dropdown === column.searchableDropdown)!.items),
});
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)
people: Array.apply(null, Array(4)).map(() => {
return {
name: faker.name.findName(),
email: faker.internet.email(),
contact: faker.helpers.createCard()
};
})
},
demo () {
return {
displayName: faker.name.findName(),
avatar: faker.image.avatar(),
email: faker.internet.email(),
randomCard: faker.helpers.createCard()
}
},
displayName () {