How to use the faker.commerce function in faker

To help you get started, we’ve selected a few faker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hql287 / Manta / app / middlewares / __tests__ / InvoicesMW.spec.js View on Github external
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,
github webkom-co / airframe-next / app / routes / components / SearchResults / SearchResultsLeftNav.js View on Github external
{ /* 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>
github flow-typed / flow-typed / definitions / npm / faker_v4.x.x / flow_v0.104.x- / test_faker_v4.x.x.js View on Github external
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();
});
github SAP / cloud-commerce-spartacus-storefront / projects / backend / mockgenerator / middlewares / createCart.js View on Github external
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',
    };
github chingu-voyage6 / grad.then / src / utils / api.js View on Github external
const response = Array.from({ length: length }, () => {
      return {
        title: title || faker.commerce.productName(),
        image: faker.image.imageUrl(),
        description: faker.lorem.sentences()
      }
    })
    setTimeout(() => {
github fluidstackdev / fluidstack / packages / server / src / scripts / fixtures.ts View on Github external
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)),
      },
    })
  })
github jeremybarbet / react-native-modalize / examples / react-navigation / src / components / modals / SectionList.js View on Github external
.map(_ => ({
            product: faker.commerce.productName(),
            price: faker.commerce.price(),
          })),
      },
github fluidstackdev / fluidstack / packages / server / src / scripts / fixtures.ts View on Github external
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 } }`)
  })
}
github SAP / cloud-commerce-spartacus-storefront / projects / backend / mockgenerator / src / services / products.js View on Github external
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',
github webkom-co / airframe-next / app / routes / Tables / ExtendedTable / components / SelectAll.js View on Github external
const data = _.times(5, (index) => ({
    id: index,
    name: faker.commerce.productName(),
    price: Math.round(2000 + Math.random() * 500)
}));