From 13b7be8cb85c142e46da5605371bd9267a6fa64e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Westk=C3=A4mper?= Date: Mon, 22 Jul 2024 09:08:34 +0300 Subject: [PATCH] Include tests in CI --- .github/workflows/ci.yml | 3 ++ src/types.ts | 73 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c020090..b97d52b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,3 +20,6 @@ jobs: - name: Run build run: npm run build + + - name: Run tests + run: npm test diff --git a/src/types.ts b/src/types.ts index 69ecb37..0abb9e1 100644 --- a/src/types.ts +++ b/src/types.ts @@ -28,7 +28,7 @@ export interface NostoClient { */ export interface Recommendation { result_id: string - products: Product[] + products: PushedProduct[] result_type: string title: string div_id: string @@ -36,6 +36,77 @@ export interface Recommendation { params: unknown } +export interface PushedProduct { + age_group?: string + alternate_image_urls: string[] + availability: string + brand?: string + category: string[] + category_id: string[] + condition?: string + custom_fields: { [index: string]: string } + date_published?: Date + description?: string + gender?: string + google_category?: string + gtin?: string + image_url?: string + inventory_level?: number + list_price?: number + name: string + parent_category_id: string[] + price: number + price_currency_code: string + product_id: string + rating_value?: number + review_count?: number + skus: PushedProductSKU[] + source_updated?: Date + supplier_cost?: number + tags1: string[] + tags2: string[] + tags3: string[] + thumb_url?: string + unit_pricing_base_measure?: number + unit_pricing_measure?: number + unit_pricing_unit?: string + update_received?: Date + url: string + variation_id?: string + variations: { [index: string]: PushedVariation } +} + +export interface PushedProductSKU extends NostoSku { } + +export interface PushedVariation extends NostoVariant { } + + +export interface NostoSku extends Sku { + inventory_level?: number +} + +export interface NostoVariant { + availability: string + available: boolean + discounted: boolean + list_price?: number + price: number + price_currency_code: string + price_text?: string +} + +export interface Sku { + availability: string + custom_fields: { [index: string]: string } + gtin?: string + id: string + image_url?: string + list_price?: number + name: string + price: number + url?: string +} + // copied from client script d.ts export declare const eventTypes: readonly ["vp", "lp", "dp", "rp", "bp", "vc", "or", "is", "cp", "ec", "es", "gc", "src", "cpr", "pl", "cc", "con"] declare type EventType = typeof eventTypes[number]