All files / src products.js

100% Statements 3/3
100% Branches 0/0
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 533x                                                                                           10x       90x    
const PRODUCTS = [
  {
    id: 1,
    name: 'Wireless Headphones',
    price: 79.99,
    image: `${import.meta.env.BASE_URL}placeholders/headphones.svg`,
    description: 'Premium wireless headphones with noise cancellation.',
  },
  {
    id: 2,
    name: 'Smart Watch',
    price: 199.99,
    image: `${import.meta.env.BASE_URL}placeholders/smart-watch.svg`,
    description: 'Fitness tracker with heart rate monitoring and GPS.',
  },
  {
    id: 3,
    name: 'USB-C Hub',
    price: 34.99,
    image: `${import.meta.env.BASE_URL}placeholders/usb-c-hub.svg`,
    description: '7-in-1 USB-C hub with HDMI, SD card, and USB 3.0 ports.',
  },
  {
    id: 4,
    name: 'Mechanical Keyboard',
    price: 129.99,
    image: `${import.meta.env.BASE_URL}placeholders/keyboard.svg`,
    description: 'RGB mechanical keyboard with Cherry MX switches.',
  },
  {
    id: 5,
    name: 'Portable Speaker',
    price: 49.99,
    image: `${import.meta.env.BASE_URL}placeholders/speaker.svg`,
    description: 'Waterproof Bluetooth speaker with 12-hour battery life.',
  },
  {
    id: 6,
    name: 'Laptop Stand',
    price: 24.99,
    image: `${import.meta.env.BASE_URL}placeholders/laptop-stand.svg`,
    description: 'Adjustable aluminum laptop stand for better ergonomics.',
  },
];
 
export function getProducts() {
  return PRODUCTS;
}
 
export function formatPrice(amount) {
  return `$${amount.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`;
}