Example #1
0
 function getRandomName(long) {
   if (long) {
     return faker.internet.domainName() + ' ' + faker.finance.accountName(); // long enough for layout testing purposes
   }
   else {
     return faker.internet.domainName();
   }
 }
Example #2
0
function randomUser() {
  return {
    name: Faker.name.findName(),
    bio: Faker.lorem.paragraph(),
    email: Faker.internet.email(),
    provider: Faker.company.companyName(),
    provider_id: Faker.helpers.randomNumber(),
    avatar_url: Faker.image.imageUrl(),
    github_url: Faker.internet.domainName(),
    github_api_url: Faker.internet.domainName(),
    public_repos_count: Faker.helpers.randomNumber(),
    follower_count: Faker.helpers.randomNumber(),
    following_count: Faker.helpers.randomNumber()
  };
}
  mentions: function (count, options) {
    count = count || 4;
    options = options || {};

    const mentions = [];

    for (let i = 0; i < count; i++) {
      let author = !i || faker.random.number(4);
      let mention = {
        author: {
          name: author ? faker.name.findName() : null,
          photo: (!i || (author && faker.random.number(2))) ? faker.image.avatar() : null,
          url: (!i || (author && faker.random.number(3))) ? 'http://' + faker.internet.domainName() + '/' : null
        },
        name: (!i || faker.random.number(6)) ? null : faker.lorem.words(1 + faker.random.number(4)).join(' '),
        published: new Date(faker.date.recent(30)).getTime(),
        summary: faker.lorem.paragraph(),
        url: 'http://' + faker.internet.domainName() + '/' + faker.lorem.words(1 + faker.random.number(4)).join('/'),
        targets: ['http://example.com/'],
        type: 'mention',
        interactions: []
      };

      if (options.interactions === true || !faker.random.number(1)) {
        if (options.interactions === true) {
          mention.type = faker.random.array_element(['like', 'repost']);
        } else if (options.interactions === false) {
          mention.type = 'reply';
        } else {
          mention.type = faker.random.array_element(['like', 'repost', 'reply']);
        }

        let jl = faker.random.number(3) + 1;
        if (options.interactions === true || !faker.random.number(1)) {
          jl -= 1;
          mention.interactions.push('http://example.com/');
        }
        for (let j = 0; j < jl; j++) {
          mention.interactions.push('http://' + faker.internet.domainName() + '/' + faker.lorem.words(1 + faker.random.number(4)).join('/'));
        }
      }

      mentions.push(mention);
    }

    return mentions;
  }
function addAssignments() {
    var assignments = [];
    var usedDomainNames = {};
    for (var i = 0; i < config.DEMO.NUMBER_OF_ASSIGNMENTS; i++) {
        var object = {};
        var domainName = faker.internet.domainName();
        while (usedDomainNames[domainName]) {
            domainName = faker.internet.domainName();
        }

        usedDomainNames[domainName] = 1;
        object.name = domainName;
        assignments.push(object);
    }

    return Promise.all(applyAddOnItemsRec(assignments, 0, assignmentController.createNewAssignment));

}
Example #5
0
 var collection = Array.apply(null, {length: 50}).map(function(){
   return {
     title: faker.lorem.sentence(),
     link: 'http://' + faker.internet.domainName(),
     description: faker.lorem.paragraphs(2),
     user: {
       name: faker.name.findName(),
       email: faker.internet.email()
     }
   };
 });
Example #6
0
 }).then(function(geo) {
   for (i = 0; i < 10; i++) {
     Creative.create({
       campaignId: geo.dataValues.campaignId,
       body: faker.lorem.sentence(),
       height: heights[i%6],
       width: widths[i%6],
       imageUrl: faker.image.imageUrl(),
       redirectUrl: faker.internet.domainName(),
       microUSD: faker.random.number(5) + 1,
     })
   }
 });
Example #7
0
var getUser = function() {
		var user = {
		firstName: faker.name.firstName(),
		lastName: faker.name.lastName(),
		email: faker.internet.email(),
		website: faker.internet.domainName(),
		username: faker.internet.userName(),
		password: faker.internet.password(),
		role: faker.random.array_element(roles),
		soc: faker.random.number(10000)
		}
		return user;
};
function generateRoomInfos() {
    var roomInfoList = [];
    for (var i = 0; i <= NUM_ROOM_INFOS; i++) {
        var r = {
            roomId: faker.random.uuid(),
            name: faker.address.streetName() + ' ' + faker.random.number(10),
            url: faker.internet.domainName(),
            theme: faker.lorem.words(1)
        };
        roomInfoList.push(r);
    }
    return roomInfoList;
}
Example #9
0
gulp.task('build', ['styles'], function() {
  var fakeData = {
    fullname: faker.name.findName(),
    title: faker.name.jobTitle(),
    username: faker.name.firstName().toLowerCase(),
    password: faker.internet.password(9),
    wifi_password: faker.internet.password(9),
    fileserver_address: 'smb://' + faker.internet.domainName(),
    webmail_url: 'http://mail.' + faker.internet.domainName(),
    google_apps_url: 'http://docs.' + faker.internet.domainName()
  };

  var templateBase = gulp.src('./templates/src/welcome*.html.j2')
    .pipe(prettify());

  var template = templateBase
    .pipe(clone())
    .pipe(inlinesource({ rootpath: './templates/preview' }))
    .pipe(gulp.dest('./templates'))
    .on('data', function(data) {
      gutil.log('Generated template', chalk.cyan(data.relative));
    });

  var preview = templateBase
    .pipe(nunjucksRender({ data: fakeData }))
    .pipe(rename(function(path) {
      path.basename = path.basename.replace('welcome', 'index');
      path.extname = '';  // seems like a bug, basename still has the extension
    }))
    .pipe(gulp.dest('./templates/preview'))
    .pipe(browserSync.stream())
    .on('data', function(data) {
      gutil.log('Rendered preview template', chalk.cyan(data.relative));
    });

  return mergeStream(template, preview);
});
function generateChartGrid(_opts) {
	_opts = _opts || {};
	var opts = _.defaults(_opts, defaultOpts);

	var randChartProps = {
		scale: {
			primaryScale: {
				prefix: faker.finance.currencySymbol(),
				suffix: " " + faker.hacker.noun() + "s",
			}
		},
		input: {
			raw: defaultInput.init_data_ordinal,
			status: "VALID",
			valid: true
		},
		chartSettings: [],
		data: [],
		extraPadding: {
			top: 0,
			right: 0,
			bottom: 0,
			left: 0
		},
		_grid: {
			type: opts.type
		},
		numColors: 11,
		mobile: {}
	};

	var randMetadata = {
		id: null,
		chartType: "chartgrid",
		title: faker.company.catchPhrase(),
		source: "Data: " + faker.company.companyName(),
		credit: faker.address.country() + " | " + faker.internet.domainName(),
		size: opts.size
	};

	var chartProps = parseChartGrid(chartGridConfig, randChartProps);
	var anyDragged = false;

	return {
		chartProps: chartProps,
		metadata: randMetadata
	};
}
Example #11
0
MongoClient.connect(url, function (err, db) {
  if (err) {
    console.log('Unable to connect to the mongoDB server. Error:', err);
  } else {
    // HURRAY!! We are connected. :)
    console.log('Connection established to', url);

    // Get the documents collection
    var collection = db.collection('users');

    // Create users
    var list = [];
    for (var i = 0; i < 100000; i++) {
      var user = {
        index: faker.random.number(),
        username: faker.internet.userName(),
        avatar: faker.image.avatar(),
        name: faker.name.firstName() + faker.name.lastName(),
        domain: faker.internet.domainName(),
        emails: [faker.internet.email()],
        roles: ['admin', 'moderator', 'user'],
        createdAt: new Date()
      };

      list.push(user);

      if (i % 300 === 299) {
        // Insert many users
        collection.insertMany(list, function (err, result) {
            if (err) {
                console.log(err);
            } else {
                console.log('Inserted %d documents into the "users" collection.', result.result.n);
            }
        });

        list = [];
      }
    }

    console.log('Users inserted!!! :D');

    // db.close();
  }
});
app.get('/api/fake/internet', function(req, res) {
	res.json([
		{
			avatar: faker.internet.avatar(),
			email: faker.internet.email(),
			exampleEmail: faker.internet.exampleEmail(),
			userName: faker.internet.userName(),
			protocol: faker.internet.protocol(),
			url: faker.internet.url(),
			domainName: faker.internet.domainName(),
			domainSuffix: faker.internet.domainSuffix(),
			domainWord: faker.internet.domainWord(),
			ip: faker.internet.ip(),
			userAgent: faker.internet.userAgent(),
			color: faker.internet.color(),
			mac: faker.internet.mac(),
			password: faker.internet.password()
		}
	])
});
app.get('/api/fake', function(req, res) {
	res.json({
		"address": {
			zipCode: faker.address.zipCode(),
			city: faker.address.city(),
			cityPrefix: faker.address.cityPrefix(),
			citySuffix: faker.address.citySuffix(),
			streetName: faker.address.streetName(),
			streetAddress: faker.address.streetAddress(),
			streetSuffix: faker.address.streetSuffix(),
			streetPrefix: faker.address.streetPrefix(),
			secondaryAddress: faker.address.secondaryAddress(),
			county: faker.address.county(),
			country: faker.address.country(),
			countryCode: faker.address.countryCode(),
			state: faker.address.state(),
			stateAbbr: faker.address.stateAbbr(),
			latitude: faker.address.latitude(),
			longitude: faker.address.longitude()
		},
		"commerce": {
			color: faker.commerce.color(),
			department: faker.commerce.department(),
			productName: faker.commerce.productName(),
			price: faker.commerce.price(),
			productAdjective: faker.commerce.productAdjective(),
			productMaterial: faker.commerce.productMaterial(),
			product: faker.commerce.product()
		},
		"company": {
			suffixes: faker.company.suffixes(),
			companyName: faker.company.companyName(),
			companySuffix: faker.company.companySuffix(),
			catchPhrase: faker.company.catchPhrase(),
			bs: faker.company.bs(),
			catchPhraseAdjective: faker.company.catchPhraseAdjective(),
			catchPhraseDescriptor: faker.company.catchPhraseDescriptor(),
			catchPhraseNoun: faker.company.catchPhraseNoun(),
			bsAdjective: faker.company.bsAdjective(),
			bsBuzz: faker.company.bsBuzz(),
			bsNoun: faker.company.bsNoun()
		},
		"date": {
			past: faker.date.past(),
			future: faker.date.future(),
			between: faker.date.between(),
			recent: faker.date.recent(),
			month: faker.date.month(),
			weekday: faker.date.weekday()
		},
		"finance": {
			account: faker.finance.account(),
			accountName: faker.finance.accountName(),
			mask: faker.finance.mask(),
			amount: faker.finance.amount(),
			transactionType: faker.finance.transactionType(),
			currencyCode: faker.finance.currencyCode(),
			currencyName: faker.finance.currencyName(),
			currencySymbol: faker.finance.currencySymbol(),
			bitcoinAddress: faker.finance.bitcoinAddress()
		},
		"hacker": {
			abbreviation: faker.hacker.abbreviation(),
			adjective: faker.hacker.adjective(),
			noun: faker.hacker.noun(),
			verb: faker.hacker.verb(),
			ingverb: faker.hacker.ingverb(),
			phrase: faker.hacker.phrase()
		},
		"helpers": {
			randomize: faker.helpers.randomize(),
			slugify: faker.helpers.slugify(),
			replaceSymbolWithNumber: faker.helpers.replaceSymbolWithNumber(),
			replaceSymbols: faker.helpers.replaceSymbols(),
			shuffle: faker.helpers.shuffle(),
			mustache: faker.helpers.mustache(),
			createCard: faker.helpers.createCard(),
			contextualCard: faker.helpers.contextualCard(),
			userCard: faker.helpers.userCard(),
			createTransaction: faker.helpers.createTransaction()
		},
		"image": {
			image: faker.image.image(),
			avatar: faker.image.avatar(),
			imageUrl: faker.image.imageUrl(),
			abstract: faker.image.abstract(),
			animals: faker.image.animals(),
			business: faker.image.business(),
			cats: faker.image.cats(),
			city: faker.image.city(),
			food: faker.image.food(),
			nightlife: faker.image.nightlife(),
			fashion: faker.image.fashion(),
			people: faker.image.people(),
			nature: faker.image.nature(),
			sports: faker.image.sports(),
			technics: faker.image.technics(),
			transport: faker.image.transport()
		},
		"internet": {
			avatar: faker.internet.avatar(),
			email: faker.internet.email(),
			exampleEmail: faker.internet.exampleEmail(),
			userName: faker.internet.userName(),
			protocol: faker.internet.protocol(),
			url: faker.internet.url(),
			domainName: faker.internet.domainName(),
			domainSuffix: faker.internet.domainSuffix(),
			domainWord: faker.internet.domainWord(),
			ip: faker.internet.ip(),
			userAgent: faker.internet.userAgent(),
			color: faker.internet.color(),
			mac: faker.internet.mac(),
			password: faker.internet.password()
		},
		"lorem": {
			word: faker.lorem.word(),
			words: faker.lorem.words(),
			sentence: faker.lorem.sentence(),
			sentences: faker.lorem.sentences(),
			paragraph: faker.lorem.paragraph(),
			paragraphs: faker.lorem.paragraphs(),
			text: faker.lorem.text(),
			lines: faker.lorem.lines()
		},
		"name": {
			firstName: faker.name.firstName(),
			lastName: faker.name.lastName(),
			findName: faker.name.findName(),
			jobTitle: faker.name.jobTitle(),
			prefix: faker.name.prefix(),
			suffix: faker.name.suffix(),
			title: faker.name.title(),
			jobDescriptor: faker.name.jobDescriptor(),
			jobArea: faker.name.jobArea(),
			jobType: faker.name.jobType()
		},
		"phone": {
			phoneNumber: faker.phone.phoneNumber(),
			phoneNumberFormat: faker.phone.phoneNumberFormat(),
			phoneFormats: faker.phone.phoneFormats()
		},
		"random": {
			number: faker.random.number(),
			arrayElement: faker.random.arrayElement(),
			objectElement: faker.random.objectElement(),
			uuid: faker.random.uuid(),
			boolean: faker.random.boolean(),
			word: faker.random.word(),
			words: faker.random.words(),
			image: faker.random.image(),
			locale: faker.random.locale(),
			alphaNumeric: faker.random.alphaNumeric()
		},
		"system": {
			fileName: faker.system.fileName(),
			commonFileName: faker.system.commonFileName(),
			mimeType: faker.system.mimeType(),
			commonFileType: faker.system.commonFileType(),
			commonFileExt: faker.system.commonFileExt(),
			fileType: faker.system.fileType(),
			fileExt: faker.system.fileExt(),
			directoryPath: faker.system.directoryPath(),
			filePath: faker.system.filePath(),
			semver: faker.system.semver()
		}
	})
});
Example #14
0
export function createShopFactory() {
  Factory.define("shop", Shops, {
    name: faker.internet.domainName(),
    description: faker.company.catchPhrase(),
    keywords: faker.company.bsAdjective(),
    addressBook: [ getAddress() ],
    domains: ["localhost"],
    emails: [
      {
        address: faker.internet.email(),
        verified: faker.random.boolean()
      }
    ],
    currency: "USD", // could use faker.finance.currencyCode()
    currencies: {
      USD: {
        format: "%s%v",
        symbol: "$"
      },
      EUR: {
        format: "%v %s",
        symbol: "€",
        decimal: ",",
        thousand: "."
      }
    },
    locale: "en",
    locales: {
      continents: {
        NA: "North America"
      },
      countries: {
        US: {
          name: "United States",
          native: "United States",
          phone: "1",
          continent: "NA",
          capital: "Washington D.C.",
          currency: "USD,USN,USS",
          languages: "en"
        }
      }
    },
    baseUOL: "in",
    unitsOfLength: [{
      uol: "in",
      label: "Inches",
      default: true
    }, {
      uol: "cm",
      label: "Centimeters"
    }, {
      uol: "ft",
      label: "Feet"
    }],
    baseUOM: "oz",
    unitsOfMeasure: [{
      uom: "oz",
      label: "Ounces",
      default: true
    }, {
      uom: "lb",
      label: "Pounds"
    }, {
      uom: "g",
      label: "Grams"
    }, {
      uom: "kg",
      label: "Kilograms"
    }],
    layout: [{
      layout: "coreLayout",
      workflow: "coreLayout",
      theme: "default",
      enabled: true
    }, {
      layout: "coreLayout",
      workflow: "coreCartWorkflow",
      collection: "Cart",
      theme: "default",
      enabled: true
    }, {
      layout: "coreLayout",
      workflow: "coreOrderWorkflow",
      collection: "Orders",
      theme: "default",
      enabled: true
    }, {
      layout: "coreLayout",
      workflow: "coreOrderShipmentWorkflow",
      collection: "Orders",
      theme: "default",
      enabled: true
    }],
    public: true,
    brandAssets: [
      {
        mediaId: "J8Bhq3uTtdgwZx3rz",
        type: "navbarBrandImage"
      }
    ],
    timezone: "US/Pacific",
    metafields: [],
    // one shop in the marketplace is required as default shop. This is used to control marketplace settings.
    // Not having a primary shop will cause test failures
    shopType: "primary",
    createdAt: new Date,
    updatedAt: new Date()
  });
}
Example #15
0
exports.genUser = function(attrs) {

	let username = '';
	do {
		username = faker.internet.userName().replace(/[^a-z0-9]+/gi, '');
	} while (username.length < 3);

	return _.extend({
		username: username,
		password: randomstring.generate(10),
		email: faker.internet.email(faker.name.firstName(), faker.name.lastName(), faker.internet.domainName()).replace('_', '.')
	}, attrs || {});
};
Example #16
0
	users: (function() {
		let res = [];
		for (let i = 0; i < 5; i++) {
			let lang = faker.helpers.randomize(['en-US', 'en-GB', 'de', 'fr', 'it']);
			//faker.locale = lang;
			let user = faker.helpers.createCard();
			user.id = i + 1;
			user.type = faker.helpers.randomize(["personal", "business"]);
			user.password = faker.internet.password(10);
			user.bio = faker.lorem.paragraph();
			let dob = faker.date.past(40, "1998-01-01");
			user.dob = dob.valueOf();
			user.time = moment().format("hh:mm:ss");
			user.age = moment().year() - moment(dob).year();
			user.rank = faker.random.number({
				min: 1,
				max: 10
			});
			user.role = faker.helpers.randomize(roles).id;
			//user.mobile = faker.phone.phoneNumber();
			user.avatar = faker.internet.avatar();

			user.skills = [];
			user.skills.push(faker.helpers.randomize(skills));
			user.skills.push(faker.helpers.randomize(skills));

			user.language = lang;
			user.status = faker.helpers.randomize([true, false, true]);
			user.created = faker.date.recent(30).valueOf();
			user.dt = faker.date.recent(30).valueOf();
			user.favoriteColor = faker.internet.color();

			if (user.type == "business") {
				user.company = {
					"name": faker.company.companyName(),
					"catchPhrase": faker.company.catchPhrase(),
					"bs": faker.company.bs(),
					"website": faker.internet.domainName(),
					"phone": faker.phone.phoneNumber(),
					"address": {
						"street": faker.address.streetAddress(),
						"city": faker.address.city(),
						"country": faker.address.country(),
						"zipcode": faker.address.zipCode(),
						"geo": {
							"lat": faker.address.latitude(),
							"lng": faker.address.longitude()
						}
					}

				}
			} else {
				user.company = undefined;
			}

			user.posts = undefined;
			user.accountHistory = undefined;

			res.push(user);
			//console.log(user);
		}
		//console.log(res);
		return res;
	})()
Example #17
0
 name: () => faker.internet.domainName(),