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 call next and dispatch notification ', () => {
const newInvoice = {
recipient: {
fullname: faker.name.findName(),
email: faker.internet.email(),
},
currency: {
code: 'USD',
placement: 'before',
fraction: 2,
separator: 'commaDot',
},
rows: [
{
id: uuidv4(),
description: faker.commerce.productName(),
price: faker.commerce.price(),
quantity: faker.random.number(10),
},
],
};
// Execute
const action = Actions.saveInvoice(newInvoice);
middleware(action).then(() =>
saveDoc('invoices', newInvoice).then(data => {
// Call next after the promised is returned
expect(next.mock.calls.length).toBe(1);
expect(next).toHaveBeenCalledWith(
Object.assign({}, action, {
payload: [
...mockData.invoicesRecords,
{ /* END Navigation */}
{ /* START Category */}
<nav>
<span>
Category
</span>
<i></i>
<span>
<i></i> { faker.commerce.department() }
</span>
<span>
({ faker.finance.mask() })
</span>
<span>
<i></i> { faker.commerce.department() }
</span>
<span>
({ faker.finance.mask() })
</span>
</nav>
describe("commerce", () => {
faker.commerce.color();
faker.commerce.department();
faker.commerce.productName();
faker.commerce.price();
faker.commerce.price(1);
faker.commerce.price(1, 2);
faker.commerce.price(1, 2, 3);
faker.commerce.price(1, 2, 3, "$");
faker.commerce.productAdjective();
faker.commerce.productMaterial();
faker.commerce.product();
});
function addCartEntry(req, res) {
const uri = url.parse(req.url, true);
const isCartEntryRoute = /(.+)entries$/.test(uri.pathname);
if (isCartEntryRoute && req.method === 'POST') {
const {
query: { quantity, code },
} = uri;
req.body = {
entry: {
entryNumber: 0,
product: {
availableForPickup: true,
code: code,
name: faker.commerce.productName(),
purchasable: true,
stock: {
stockLevel: 4,
},
url: '/product-url',
},
quantity: quantity,
totalPrice: {
currencyIso: 'USD',
value: 260.87,
},
},
quantity: quantity,
quantityAdded: quantity,
statusCode: 'success',
};
const response = Array.from({ length: length }, () => {
return {
title: title || faker.commerce.productName(),
image: faker.image.imageUrl(),
description: faker.lorem.sentences()
}
})
setTimeout(() => {
return job(n, () => {
return prisma.createProduct({
name: faker.commerce.productName(),
brand: {
connect: { id: pickRnd(allBrands).id },
},
attributes: {
connect: arr(_.random(0, 20)).map(() => ({
id: pickRnd(allAttributes).id,
})),
},
type: {
connect: { id: pickRnd(allProductTypes).id },
},
variants: {
create: arr(_.random(0, 10)).map(() => generateVariant(allOptions)),
},
})
})
.map(_ => ({
product: faker.commerce.productName(),
price: faker.commerce.price(),
})),
},
return job(n, () => {
return prisma
.createOption({
name: faker.commerce.productAdjective(),
values: {
create: _.uniqBy(
arr(5).map(() => ({ name: faker.commerce.productMaterial() })),
'name',
),
},
})
.$fragment(`fragment tmp on Option { id name values { id name } }`)
})
}
value: faker.commerce.price(),
},
images: [
{
url: faker.random.image(),
format: 'thumbnail',
imageType: 'PRIMARY',
},
{
altText: faker.commerce.productName(),
url: faker.random.image(),
format: 'product',
imageType: 'PRIMARY',
},
{
altText: faker.commerce.productName(),
url: faker.random.image(),
format: 'zoom',
imageType: 'GALLERY',
galleryIndex: 0,
},
{
altText: faker.commerce.productName(),
url: faker.random.image(),
format: 'product',
imageType: 'GALLERY',
galleryIndex: 0,
},
{
altText: faker.commerce.productName(),
url: faker.internet.avatar(),
format: 'thumbnail',
const data = _.times(5, (index) => ({
id: index,
name: faker.commerce.productName(),
price: Math.round(2000 + Math.random() * 500)
}));