Example #1
0
const seedingMyMessages = () => {
  for (let i = 1; i <= 500; i += 1) {
    const message = faker.lorem.sentences();
    const listing = faker.random.number({ min: 1, max: 100 });
    const username = faker.internet.userName();
    const userId = faker.random.number(800);
    const profilePic = faker.internet.avatar();
    const date = faker.date.between('2015-01-01', '2019-04-30');
    const accuracy = faker.finance.amount(0, 5, 2);
    const communication = faker.finance.amount(0, 5, 2);
    const cleanliness = faker.finance.amount(0, 5, 2);
    const checkIn = faker.finance.amount(0, 5, 2);
    const value = faker.finance.amount(0, 5, 2);
    const location = faker.finance.amount(0, 5, 2);


    const realDate = moment(date).format('YYYY-MM-DD');
    db.query(`INSERT INTO Messages(message, user_id, username, profile_picture, listing, date, accuracy, communication, cleanliness, check_in, value, location) VALUES('${message}', ${userId}, '${username}', '${profilePic}', ${listing}, '${realDate}', ${accuracy}, ${communication}, ${cleanliness}, ${checkIn}, ${value}, ${location});`, (err, data) => {
      if (err) {
        console.log('ERROR GETTING DATA INSERTED', err);
      } else {
        console.log('SUCCESSFUL ENTRY', data);
      }
    });
  }
};
Example #2
0
  User.count({}, function (error, count) {
    if (error || !count) {
      for (var i = 0; i < 100; i++) {
        var gender = faker.random.arrayElement(['male', 'female']);
        var firstName = faker.name.firstName(gender);
        var lastName = faker.name.lastName(gender);

        var user = new User({
          firstName: firstName,
          lastName: lastName,
          gender: gender,
          avatar: faker.internet.avatar(),
          phone: faker.phone.phoneNumber(),
          bio: faker.lorem.paragraphs()
        });

        user.save(function (error, user, numAffected) {
          if (error) {
            console.log(error);
          }

          if (user) {
            console.log(user._id);
          }
        });
      }
    }
  });
const seedingMyMessages = () => {
  for (let i = 1; i <= 5000; i += 1) {
    const month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
    const year = ['2015', '2016', '2017', '2018', '2019'];
    const message = faker.lorem.sentences();
    const listing = faker.random.number({ min: 1, max: 100 });
    const username = faker.name.firstName();
    const userId = faker.random.number(800);
    const profilePic = faker.internet.avatar();
    const date = `${month[Math.floor(Math.random() * 12)]} ${year[Math.floor(Math.random() * 5)]}`;
    const accuracy = faker.finance.amount(0, 5, 2);
    const communication = faker.finance.amount(0, 5, 2);
    const cleanliness = faker.finance.amount(0, 5, 2);
    const checkIn = faker.finance.amount(0, 5, 2);
    const value = faker.finance.amount(0, 5, 2);
    const location = faker.finance.amount(0, 5, 2);


    db.query(`INSERT INTO Messages(message, user_id, username, profile_picture, listing, date, accuracy, communication, cleanliness, check_in, value, location) VALUES('${message}', ${userId}, '${username}', '${profilePic}', ${listing}, '${date}', ${accuracy}, ${communication}, ${cleanliness}, ${checkIn}, ${value}, ${location});`, (err, data) => {
      if (err) {
        console.log('ERROR GETTING DATA INSERTED', err);
      } else {
        console.log('SUCCESSFUL ENTRY', data);
      }
    });
  }
};
Example #4
0
export const implementsImageProp = (Component, requiredProps = {}) => {
  const imageSrc = faker.internet.avatar()
  const assertValid = (wrapper) => {
    wrapper.should.have.descendants('Image')
    wrapper.find('Image')
      .should.have.prop('src', imageSrc)
  }
  describe('image (common)', () => {
    _noDefaultClassNameFromProp(Component, 'image')

    it('has no img when prop is not defined', () => {
      shallow(<Component />)
        .should.not.have.descendants('img')
    })

    it('adds a img as first child', () => {
      shallow(<Component image={imageSrc} />)
        .childAt(0)
        .should.match('img')
    })

    it('accepts an Image instance', () => {
      const image = <Image src={imageSrc} />
      assertValid(shallow(<Component image={image} />))
    })

    it('accepts an image src string', () => {
      assertValid(shallow(<Component image={imageSrc} />))
    })
  })
}
Example #5
0
 people: _.times(100, function(n) {
    return {
      id: n,
      name: faker.name.findName(),
      avatar: faker.internet.avatar()
    }
 })
Example #6
0
module.exports.newUser = (id, cb) => {
    User.create({
        _id: id,
        login: faker.internet.userName(),
        avatar: faker.internet.avatar()
    })
        .then(() => cb());
};
 function handleKeyup (e) {
   let user = new User({
     username: e.currentTarget.value,
     avatar: faker.internet.avatar(),
     lorem: faker.lorem.sentence()
   })
   send('users:updateUserState', { payload: user })
 }
Example #8
0
 const createTweet = (body) => ({
   id: faker.random.uuid(),
   body,
   author: {
     username: faker.internet.userName(),
     avatar: faker.internet.avatar(),
     email: faker.internet.email()
   }
 });
Example #9
0
 beforeEach(function () {
   author = {
     name: faker.name.firstName(),
     description: faker.lorem.paragraph(),
     books: [],
     webSite: faker.internet.url(),
     avatar: faker.internet.avatar()
   }
 })
Example #10
0
 generateLikes = (maxLikes = 10) => {
   const numberLikes = Math.floor(Math.random() * maxLikes) + 1;
   for (let i = 0; i <= numberLikes; i++) {
     this.likes.push({
       username: Faker.internet.userName(),
       profile_pic: Faker.internet.avatar()
     })
   }
 }
Example #11
0
export function generateUser() {
  return {
    name: faker.name.findName(),
    email: faker.internet.email(),
    profile_pic: faker.internet.avatar(),
    status: txtgen.sentence(),
    user_id: shortid.generate()
  };
}
Example #12
0
 .then(() => knex('users')
   .insert({
     name,
     email,
     active: true,
     avatar_url: faker.internet.avatar(),
     email_validated: true,
     created_at: knex.fn.now()
   })
   .returning('id'))
Example #13
0
 generateComments = (maxComments = 3) => {
   const numberLikes = Math.floor(Math.random() * maxComments) + 1;
   for (let i = 0; i <= numberLikes; i++) {
     this.comments.push({
       id: Faker.random.uuid(),
       text: Faker.lorem.sentence(),
       username: Faker.internet.userName(),
       profile_pic: Faker.internet.avatar()
     })
   }
 }
Example #14
0
function randomUser() {
    return {
        email: faker.internet.email(),
        password: 'password',
        firstName: faker.name.firstName(),
        lastName: faker.name.lastName(),
        avatarUrl: faker.internet.avatar(),
        joinedOn: faker.date.recent(JOINED_DAYS_AGO),
        preferredVersionId: random.pick(_versionObjects).id,
        groups: _.times(random.integer(1, 2), n => randomGroup())
    }
}
Example #15
0
 member: _.times(30, function(n){
   return {
     id: n,
     name: faker.name.findName(),
     avatar: faker.internet.avatar(),
     title: faker.name.jobTitle(),
     day_start: faker.random.number({min:1, max:90}),
     day_end: faker.random.number({min:1, max:90}),
     follower: faker.random.number({min:10, max:999}),
     following: faker.random.number({min:10, max:999}),
     reviews: faker.random.number({min:10, max:999})
   }
 })
Example #16
0
function fakeNetwork (_, Promise) {
  const name = faker.random.words()
  const past = faker.date.past()

  return Promise.resolve({
    name,
    description: faker.lorem.paragraph(),
    avatar_url: faker.internet.avatar(),
    banner_url: faker.image.imageUrl(),
    slug: faker.helpers.slugify(name).toLowerCase(),
    created_at: past,
    updated_at: past
  })
}
Example #17
0
exports.getLocalUser = function () {
    return {
        authType: 'local',
        created: faker.date.past(),
        firstName: faker.name.firstName(),
        gender: userEnums.gender.male,
        _id: mongoose.Types.ObjectId(),
        lastName: faker.name.lastName(),
        passwordHash: faker.internet.password(),
        photoUrl: faker.internet.avatar(),
        username: faker.internet.userName(),
        userType: userEnums.userType.user
    };
};
Example #18
0
    const list = ((total, list = []) => {

        while (list.length < total) {

            list.push({
                id   : faker.random.uuid(),
                name : faker.commerce.productName(),
                cover: faker.internet.avatar()
            });
        }

        return list;

    })(faker.random.number({min: 1, max: 5}));
Example #19
0
  listData: computed('numOfRows', function() {
    let contacts = [];
    let numOfRows = this.get('numOfRows');

    for (let i = 0; i < numOfRows; i++) {
      contacts.push({
        name: faker.name.findName(),
        email: faker.internet.email(),
        img: faker.internet.avatar()
      });
    }

    return contacts;
  }),
Example #20
0
exports.getPassportUser = function () {
    return {
        id: faker.random.number().toString(),
        username: faker.internet.userName(),
        name: {
            givenName: faker.name.firstName(),
            familyName: faker.name.lastName()
        },
        photos: [
            { value: faker.internet.avatar() }
        ],
        provider: 'vkontakte',
        profileUrl: faker.internet.url()
    }
};
Example #21
0
  constructor(){
    this.id = Faker.random.uuid();
    this.user = {
      username: Faker.internet.userName(),
      profile_pic: Faker.internet.avatar()
    }
    this.image = {
      url: Faker.image.image()
    };
    this.caption = Faker.lorem.sentences();
    this.likes = [];
    this.comments = [];

    this.generateLikes();
    this.generateComments();

  }
Example #22
0
  altContacts: computed('numOfContacts', function() {
    let contacts = [];
    let numOfContacts = this.get('numOfContacts');

    for (let i = 0; i < numOfContacts; i++) {
      let firstName = faker.name.firstName();
      let lastName = faker.name.lastName();

      contacts.push({
        shortName: `${firstName} ${lastName[0]}`,
        emailAddress: `${firstName.toLowerCase()}.${lastName[0].toLowerCase()}@example.com`,
        profileImage: faker.internet.avatar()
      });
    }

    return contacts;
  }),
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()
		}
	])
});
Example #24
0
function generatePerson(id) {
  return {
    id: id,
    name: {
      given: faker.name.firstName(),
      family: faker.name.lastName()
    },
    email: faker.internet.email(),
    username: faker.internet.userName(),
    avatar: faker.internet.avatar(),
    company: faker.company.companyName(),
    address: {
      street: faker.address.streetAddress(),
      city: faker.address.city(),
      state: faker.address.state(),
      zip: faker.address.zipCode(),
      country: faker.address.country()
    },
    phone: faker.phone.phoneNumber(),
    note: faker.lorem.paragraph()
  }
}
Example #25
0
 .then(([ users, networks ]) => ({
   name,
   avatar_url: faker.internet.avatar(),
   background_url: faker.image.imageUrl(),
   beta_access_code: faker.random.uuid(),
   description: faker.lorem.paragraph(),
   slug: faker.helpers.slugify(name).toLowerCase(),
   daily_digest: faker.random.boolean(),
   membership_fee: faker.random.number(),
   plan_guid: faker.random.uuid(),
   banner_url: faker.internet.url(),
   category: faker.random.uuid(),
   created_at: faker.date.past(),
   created_by_id: users[0].id,
   leader_id: users[0].id,
   welcome_message: faker.lorem.paragraph(),
   network_id: networks[0].id,
   location: faker.address.country(),
   slack_hook_url: faker.internet.url(),
   slack_team: faker.internet.url(),
   slack_configure_url: faker.internet.url()
 }))
Example #26
0
function createUser(options) {
  if (typeof options === 'string') {
    var name = options;
    options  = {
      name: name,
      nickname: name,
      password: name,
      email: name + '@demo.com'
    };
  }
  var firstName = faker.name.firstName();
  return _.extend({
    name: firstName + ' ' + faker.name.lastName(),
    nickname: options.nickname || firstName,
    gender: faker.random.array_element([0, 1]),
    avatar: faker.internet.avatar(),
    city: faker.address.city(),
    signature: faker.lorem.sentence(),
    email: firstName + '@demo.com',
    password: firstName,
    mobile: faker.phone.phoneNumber()
    //bg_image: faker.image.nature(640, 400)
  }, options);
}
Example #27
0
function fakeUser (_, Promise) {
  return Promise.resolve({
    email: faker.internet.email(),
    name: `${faker.name.firstName()} ${faker.name.lastName()}`,
    avatar_url: faker.internet.avatar(),
    first_name: faker.name.firstName(),
    last_name: faker.name.lastName(),
    last_login_at: faker.date.past(),
    active: true,
    email_validated: true,
    created_at: faker.date.past(),
    bio: faker.lorem.paragraph(),
    banner_url: faker.image.imageUrl(),
    twitter_name: faker.internet.userName(),
    linkedin_url: faker.internet.url(),
    facebook_url: faker.internet.url(),
    work: faker.lorem.paragraph(),
    intention: faker.lorem.paragraph(),
    extra_info: faker.lorem.paragraph(),
    updated_at: faker.date.past(),
    location: faker.address.country(),
    url: faker.internet.url()
  })
}
Example #28
0
 it('adds the value to the Image className', () => {
   const src = faker.internet.avatar()
   shallow(<Label image={src} />)
     .find('Image')
     .should.have.prop('src', src)
 })
Example #29
0
 it('adds an img as first child', () => {
   shallow(<Label image={faker.internet.avatar()}><br /></Label>)
     .find('Image')
     .should.have.tagName('img')
 })
Example #30
0
 it('adds image className when defined', () => {
   const src = faker.internet.avatar()
   shallow(<Label image={src} />)
     .should.have.className('image')
 })