Skip to content

Instantly share code, notes, and snippets.

@morintd
Created July 5, 2024 16:58
Show Gist options
  • Save morintd/49324c4289ae55f88bb27edfc2ad4adb to your computer and use it in GitHub Desktop.
Save morintd/49324c4289ae55f88bb27edfc2ad4adb to your computer and use it in GitHub Desktop.
const { faker } = require('@faker-js/faker');
function register(_requestParams, ctx, _ee, next) {
const id = faker.datatype.number();
ctx.vars['email'] = faker.internet.email().split('@').join(`${id}@`);
ctx.vars['password'] = faker.internet.password(10);
return next();
}
function generateArticle(_requestParams, ctx, _ee, next) {
const id = faker.datatype.hexadecimal({ length: 100 });
ctx.vars['title'] = faker.lorem.word() + id;
ctx.vars['content'] = faker.lorem.sentence(1) + id;
return next();
}
module.exports = {
register,
generateArticle,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment