Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// -----------------------------------------------------------------------------
// CREATE A FAKE DATA
const faker = require('faker')
const Chance = require('chance')
const chance = new Chance()
let account = {}
account.first = faker.name.firstName()
account.last = faker.name.lastName()
account.name = `${account.first} ${account.last}`
account.username = account.first.toLowerCase()
account.email = `${account.username.toLowerCase()}@${account.last.toLowerCase()}.com`
account.password = faker.internet.password()
account.birthDate = chance.birthday({type: 'adult'})
account.image = faker.image.imageUrl()
account.roles = 'user'
// -----------------------------------------------------------------------------
describe('auth', () => {
// ---------------------------------------------------------------------------
describe('accounts preparation', () => {
it('should able to delete all accounts via /accounts/actions/delete', (done) => {
chai
.request(server)
.delete(`${endpoint}/actions/delete`)
.set('X-API-Key', process.env.API_KEY_SETUP)
.then(res => {
expect(res.body).to.be.an('object')
done()
latitudeDelta: 0.005,
longitudeDelta: 0.005
}
}
});
// User management
const userToken = { token: 'mKfeazoJjfezafoJfhezifuhJ' };
const checkUserToken = { status: 'OK' };
const getCurrentUser = {
id: 'currentUserId',
firstName: faker.name.firstName(),
lastName: faker.name.lastName(),
avatar: faker.image.avatar(),
description: faker.lorem.words(),
seen: [...Array(Math.floor(Math.random() * friendsNb))].map(() =>
usersBase[Math.floor(Math.random() * usersNb)]
)
};
// TODO: Remove when create user form will be OK
users.push(getCurrentUser);
const currentUserPicture = {
avatar: faker.image.avatar()
};
const db = {
users,
comments,
const resolveImages = ({
name,
width,
height
}: {
name: string;
width: number;
height: number;
}) => {
switch (name) {
case "dataUri":
return faker.image.dataUri(width, height);
break;
default:
return `https://source.unsplash.com/${width}x${height}/?${name}`;
break;
}
};
// type ImageLib = Partial<{ [x in keyof typeof faker["image"]]: any }>;
const faker = require('faker');
const categories = require('../../../src/utils/categories');
const getCategory = () => {
const MAX = categories.length - 1;
const MIN = 0;
const RANDOM_INDEX = Math.floor(Math.random() * (MAX - MIN + 0)) + MIN;
return categories[RANDOM_INDEX];
};
module.exports = {
thumbnailImageURL: faker.image.people(),
description: faker.lorem.paragraph(),
imageURL: faker.image.people(),
title: faker.lorem.paragraph(),
category: getCategory(),
stars: 3.5,
duration: '01:11',
durationInSeconds: 71,
fileName: 'filename',
};
getInitialState() {
this._columns = [
{
key: 'id',
name: 'ID',
width: 80,
resizable: true
},
{
key: 'avartar',
name: 'Avartar',
width: 60,
formatter: ImageFormatter,
resizable: true,
headerRenderer:
},
{
key: 'county',
name: 'County',
editor: ,
width: 200,
resizable: true
},
{
key: 'title',
name: 'Title',
editor: ,
width: 200,
resizable: true,
events: {
onDoubleClick: function() {
image () { return faker.image() },
getUser () {
const titles = ['Dr.', 'Mr.', 'Mrs.', 'Miss', 'Ms.'];
const columns = [
{
key: 'id',
name: 'ID',
width: 80,
resizable: true
},
{
key: 'avartar',
name: 'Avartar',
width: 60,
formatter: ImageFormatter,
resizable: true,
headerRenderer:
},
{
key: 'county',
name: 'County',
editor: ,
width: 200,
resizable: true
},
{
key: 'title',
name: 'Title',
editor: ,
width: 200,
resizable: true,
events: {
onDoubleClick: function() {
tweets: _.times(30, function(index) {
return {
id: index,
user: {
name: faker.name.findName(),
username: faker.internet.userName(),
avatar: faker.image.avatar(),
cover: faker.image.image(),
bio: faker.lorem.sentence(),
location: faker.address.city(),
following: faker.random.number(1000),
followers: faker.random.number(10000)
},
time: faker.date.recent(10),
tweetContent: faker.lorem.sentences(2),
likes: faker.random.number(500),
retweets: faker.random.number(500),
replies: faker.random.number(500)
};
}),
userTweets: _.times(20, function(index) {
src: ({ propName }) => ({
hook: useStringKnob,
name: propName,
initialValue: faker.image.avatar(),
}),
}
const faker = require('faker');
const utils = require('../utils/utils');
faker.locale = 'zh_CN';
const productStructure = {
id: faker.random.number(),
name: faker.name.findName(),
cover_url: faker.image.image(),
description: faker.lorem.text(),
type: faker.random.number(),
link_url: faker.internet.url(),
min_price: faker.random.number(),
sales_num: faker.random.number(),
company: faker.company.companyName(),
recommend: faker.random.number(),
status: 1,
start_time: faker.date.future(),
end_time: faker.date.future(),
};
const productList = utils.repeatData(productStructure, 20);
const List = {
status_no: 0,