← back to Handbag Auth Nextjs

auction-viewer/tests/fixtures/test-data.js

163 lines

/**
 * Test Fixtures - Mock Auction Data
 */

const generateAuctionId = (index) => `auction-${Date.now()}-${index}`;

const mockAuctions = [
  {
    auction_id: generateAuctionId(1),
    title: 'Hermes Birkin 30cm Noir Togo Leather Gold Hardware',
    auction_house: 'Christie\'s',
    current_price: 15000,
    estimate_low: 18000,
    estimate_high: 22000,
    end_date: '2024-01-15',
    lot_number: '123',
    url: 'https://www.christies.com/lot/123',
    search_term: 'Hermes Birkin'
  },
  {
    auction_id: generateAuctionId(2),
    title: 'Chanel Classic Flap Medium Black Caviar Silver Hardware',
    auction_house: 'Sotheby\'s',
    current_price: 5500,
    estimate_low: 6000,
    estimate_high: 8000,
    end_date: '2024-01-20',
    lot_number: '456',
    url: 'https://www.sothebys.com/lot/456',
    search_term: 'Chanel Classic Flap'
  },
  {
    auction_id: generateAuctionId(3),
    title: 'Louis Vuitton Neverfull MM Monogram Canvas',
    auction_house: 'Heritage Auctions',
    current_price: 800,
    estimate_low: 1200,
    estimate_high: 1500,
    end_date: '2024-01-25',
    lot_number: '789',
    url: 'https://www.ha.com/lot/789',
    search_term: 'Louis Vuitton Neverfull'
  },
  {
    auction_id: generateAuctionId(4),
    title: 'Dior Lady Dior Medium Black Patent Leather',
    auction_house: 'Phillips',
    current_price: 3200,
    estimate_low: 4000,
    estimate_high: 5000,
    end_date: '2024-02-01',
    lot_number: '321',
    url: 'https://www.phillips.com/lot/321',
    search_term: 'Dior Lady Dior'
  },
  {
    auction_id: generateAuctionId(5),
    title: 'Gucci Dionysus Small GG Supreme',
    auction_house: 'Bonhams',
    current_price: 1100,
    estimate_low: 1500,
    estimate_high: 2000,
    end_date: '2024-02-05',
    lot_number: '654',
    url: 'https://www.bonhams.com/lot/654',
    search_term: 'Gucci Dionysus'
  }
];

// Generate large dataset for performance testing
const generateLargeDataset = (count = 1000) => {
  const brands = [
    'Hermes Birkin',
    'Hermes Kelly',
    'Chanel Classic Flap',
    'Chanel Boy',
    'Louis Vuitton Neverfull',
    'Dior Lady Dior',
    'Gucci Dionysus',
    'Prada Galleria'
  ];

  const auctionHouses = [
    'Christie\'s',
    'Sotheby\'s',
    'Phillips',
    'Bonhams',
    'Heritage Auctions'
  ];

  const auctions = [];

  for (let i = 0; i < count; i++) {
    const brand = brands[i % brands.length];
    const auctionHouse = auctionHouses[i % auctionHouses.length];
    const estimateLow = Math.floor(Math.random() * 20000) + 1000;
    const estimateHigh = estimateLow + Math.floor(Math.random() * 10000);
    const currentPrice = Math.floor(estimateLow * (0.5 + Math.random() * 0.8));

    auctions.push({
      auction_id: generateAuctionId(i + 100),
      title: `${brand} Luxury Handbag #${i}`,
      auction_house: auctionHouse,
      current_price: currentPrice,
      estimate_low: estimateLow,
      estimate_high: estimateHigh,
      end_date: `2024-${String(Math.floor(Math.random() * 12) + 1).padStart(2, '0')}-${String(Math.floor(Math.random() * 28) + 1).padStart(2, '0')}`,
      lot_number: String(Math.floor(Math.random() * 10000)),
      url: `https://example.com/lot/${i}`,
      search_term: brand
    });
  }

  return auctions;
};

// Edge cases and error scenarios
const edgeCaseAuctions = [
  {
    auction_id: generateAuctionId(901),
    title: 'Invalid Price Test',
    auction_house: 'Test House',
    current_price: 0,
    estimate_low: 0,
    estimate_high: 0,
    end_date: '2024-01-01',
    lot_number: '000',
    url: 'https://test.com/000',
    search_term: 'Test'
  },
  {
    auction_id: generateAuctionId(902),
    title: 'Negative Savings Test',
    auction_house: 'Test House',
    current_price: 5000,
    estimate_low: 3000,
    estimate_high: 4000,
    end_date: '2024-01-01',
    lot_number: '001',
    url: 'https://test.com/001',
    search_term: 'Test'
  },
  {
    auction_id: generateAuctionId(903),
    title: 'Missing Data Test',
    auction_house: null,
    current_price: null,
    estimate_low: null,
    estimate_high: null,
    end_date: null,
    lot_number: null,
    url: null,
    search_term: 'Test'
  }
];

module.exports = {
  mockAuctions,
  generateLargeDataset,
  edgeCaseAuctions,
  generateAuctionId
};