-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-validator.cjs
More file actions
36 lines (33 loc) · 980 Bytes
/
check-validator.cjs
File metadata and controls
36 lines (33 loc) · 980 Bytes
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
const { mapProductToSchema } = require('./lib/schemas/mapper');
const { validator } = require('./lib/schemas/validator');
const validProductFixture = {
id: 'prod-123',
sku: 'SKU-001',
name: 'Test Product',
description: 'A test product description',
imageUrl: 'https://example.com/product.jpg',
brand: 'TestBrand',
price: 99.99,
compareAtPrice: 129.99,
costPrice: 50.00,
currency: 'USD',
inventory: 100,
availability: 'IN_STOCK',
category: 'Electronics',
tags: ['tag1', 'tag2'],
weight: 1.5,
length: 20,
width: 15,
height: 10,
rating: 4.5,
reviewCount: 150,
gtin: '1234567890123',
mpn: 'MPN-001',
isActive: true,
createdAt: new Date('2024-01-01'),
updatedAt: new Date('2024-06-01'),
};
const product = mapProductToSchema(validProductFixture);
console.log('Mapped product:', JSON.stringify(product, null, 2));
const result = validator.validateProduct(product);
console.log('Validation result:', JSON.stringify(result, null, 2));