Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("should handle request without custom headers", () => {
// Arrange
const name = faker.random.word();
const requestOptions: WardenRequestOptions = {
url: faker.internet.url(),
method: 'get'
};
const routeConfiguration = {
identifier: faker.random.word()
} as RouteConfiguration;
const headStream = {
connect: sandbox.stub().returnsArg(0),
start: sandbox.stub()
};
const networkStream = {
connect: sandbox.stub().returnsArg(0)
};
const key = faker.random.word();
const keyMaker = sandbox.stub().returns(key);
streamFactoryMock.expects('createHead').withExactArgs().returns(headStream);
streamFactoryMock.expects('createNetwork').withExactArgs(name).returns(networkStream);
await timesAsync(4, async n => {
// Создаем пользователя
const name = faker.name.firstName()
const user = new User({
name: name,
username: name.toLocaleLowerCase(),
email: faker.internet.email(),
password: '123456'
})
await user.save()
// Создаем проект
const project = new Project({
title: `Project-${n + 1}`,
slug: `project-${n + 1}`,
key: faker.hacker
.adjective()
.slice(0, 3)
.toUpperCase(),
description: faker.lorem.sentence(3),
taskIncId: 0
})
// Добавляем проекту владельца
In Percy's screenshot (but not local dev) the current date should be frozen to 2015
thanks to mockdate and inPercy.
<p></p>
<p>
See storybook/config.js or
<a href="https://github.com/boblauer/MockDate">mockdate's docs</a>
for how it's configured.
</p>
<p>
The current date is: {new Date().toLocaleDateString()}
</p>
,
);
const name = faker.name.findName();
const email = faker.internet.email();
storiesOf('Managing Dynamic Data.Faker', module).add('Show a fake name and email', () =>
<div>
<p>
In Percy's screenshot (but not local dev) the fake data should be the same thanks to
faker's seed and inPercy.
</p>
<p>
See storybook/config.js or
<a href="https://www.npmjs.com/package/faker#setting-a-randomness-seed">faker's docs</a>
for how it's configured.
</p>
<p>
The name is: {name}
</p>
<p></p></div>
fake.users = function() {
var user = {
password: faker.internet.password(),
email: faker.internet.email(),
username: faker.internet.userName()
};
return Promise.resolve(user).then(db.users.create);
};
username() {
return faker.internet.userName() + _.random(0, 1000);
},
.map((_, index) => ({
id: index,
protocolId: '',
createdAt: timestamp(_faker.date.recent()),
updatedAt: timestamp(_faker.date.recent()),
title: _faker.name.findName(),
topic: _faker.random.words(),
avatarUri: _faker.internet.avatar(),
kind: randomValue(_api.berty.chatmodel.Conversation.Kind),
badge: _faker.random.number() % 20,
messages: [],
members: [],
lastMessageId: _faker.random.number() % 50,
lastMessage: null,
}))
export const Member: Array<_api.berty.chatmodel.IMember> = randomArray(20)
<a id="UncontrolledTooltipDownload" href="#">
<i></i>
</a>
Download
,
];
/*eslint-enable */
/*eslint-disable */
const paymentMethod = [
<i></i>
{ faker.internet.email() }
,
<i></i>
Visa 4*** **** **** 9221
];
/*eslint-enable */
/*eslint-disable */
const status = [
<i></i>
,
<i></i>
];
export const entrypoint = (supplied: any = {}) => ({
id: id(),
appId: id(),
urlMatcher: `${faker.internet.domainName()}/${faker.hacker.noun()}/`,
bundleId: Math.random() > 0.5 ? id() : null,
redirectTo: Math.random() > 0.5 ? faker.internet.url() : null,
configuration: Math.random() > 0.5 ? { KEY: "VALUE" } : null,
createdAt: faker.date.past(),
updatedAt: faker.date.past(),
...supplied
});
const userBuilder = () => ({
email: faker.internet.email(),
password: faker.internet.password()
});
export const customerFactory = (params = {}) => {
const customer = new Customers({
firstName: params.firstName || faker.random.word(),
lastName: params.lastName || faker.random.word(),
email: params.email || faker.internet.email(),
phone: params.phone || faker.phone.phoneNumber(),
messengerData: params.messengerData || {},
customFieldsData: params.customFieldsData || {},
companyIds: params.companyIds || [faker.random.number(), faker.random.number()],
tagIds: params.tagIds || [faker.random.number(), faker.random.number()],
twitterData: params.twitterData || { id: faker.random.number() },
});
return customer.save();
};