/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { expect, test } from "vitest"; import { Apideck } from "../index.js"; import { createTestHTTPClient } from "./testclient.js"; test("Products Ecommerce Products All", async () => { const testHttpClient = createTestHTTPClient("ecommerce.productsAll"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.ecommerce.products.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", passThrough: { "search": "San Francisco", }, fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getProductsResponse).toBeDefined(); expect(result.getProductsResponse).toEqual({ statusCode: 200, status: "OK", service: "shopify", resource: "products", operation: "all", data: [ { id: "12345", name: "MacBook Pro", description: "Powerful and portable, the MacBook Pro is perfect for professionals and creatives.", status: "active", price: "1999.99", sku: "MBP123", inventoryQuantity: "10", images: [ { id: "12345", url: "https://example.com/macbook-pro.jpg", }, { id: "12345", url: "https://example.com/macbook-pro.jpg", }, ], weight: "1.25", weightUnit: "lb", options: [ { id: "1", name: "Color", values: [ "Red", ], }, { id: "1", name: "Color", values: [ "Red", ], }, { id: "1", name: "Color", values: [ "Red", ], }, ], variants: [ { id: "1", name: "Midnight 16inch MacBook Pro", price: "1999.99", sku: "MBP123-16GB-SILVER-13", inventoryQuantity: "5", weight: "1.25", weightUnit: "lb", options: [ { id: "1", name: "Color", value: "Silver", }, ], images: [ { id: "12345", url: "https://example.com/macbook-pro.jpg", }, ], }, ], tags: [ "Apple", ], categories: [ { id: "12345", name: "Laptops", }, { id: "12345", name: "Laptops", }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), updatedAt: new Date("2020-09-30T07:43:32.000Z"), }, { id: "12345", name: "MacBook Pro", description: "Powerful and portable, the MacBook Pro is perfect for professionals and creatives.", status: "active", price: "1999.99", sku: "MBP123", inventoryQuantity: "10", images: [ { id: "12345", url: "https://example.com/macbook-pro.jpg", }, { id: "12345", url: "https://example.com/macbook-pro.jpg", }, ], weight: "1.25", weightUnit: "lb", options: [ { id: "1", name: "Color", values: [ "Red", ], }, ], variants: [ { id: "1", name: "Midnight 16inch MacBook Pro", price: "1999.99", sku: "MBP123-16GB-SILVER-13", inventoryQuantity: "5", weight: "1.25", weightUnit: "lb", options: [ { id: "1", name: "Color", value: "Silver", }, ], images: [ { id: "12345", url: "https://example.com/macbook-pro.jpg", }, ], }, { id: "1", name: "Midnight 16inch MacBook Pro", price: "1999.99", sku: "MBP123-16GB-SILVER-13", inventoryQuantity: "5", weight: "1.25", weightUnit: "lb", options: [ { id: "1", name: "Color", value: "Silver", }, { id: "1", name: "Color", value: "Silver", }, { id: "1", name: "Color", value: "Silver", }, ], images: [ { id: "12345", url: "https://example.com/macbook-pro.jpg", }, { id: "12345", url: "https://example.com/macbook-pro.jpg", }, ], }, { id: "1", name: "Midnight 16inch MacBook Pro", price: "1999.99", sku: "MBP123-16GB-SILVER-13", inventoryQuantity: "5", weight: "1.25", weightUnit: "lb", options: [ { id: "1", name: "Color", value: "Silver", }, { id: "1", name: "Color", value: "Silver", }, ], images: [ { id: "12345", url: "https://example.com/macbook-pro.jpg", }, ], }, ], tags: [ "Apple", ], categories: [ { id: "12345", name: "Laptops", }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), updatedAt: new Date("2020-09-30T07:43:32.000Z"), }, { id: "12345", name: "MacBook Pro", description: "Powerful and portable, the MacBook Pro is perfect for professionals and creatives.", status: "active", price: "1999.99", sku: "MBP123", inventoryQuantity: "10", images: [ { id: "12345", url: "https://example.com/macbook-pro.jpg", }, { id: "12345", url: "https://example.com/macbook-pro.jpg", }, ], weight: "1.25", weightUnit: "lb", options: [ { id: "1", name: "Color", values: [ "Red", ], }, { id: "1", name: "Color", values: [ "Red", ], }, ], variants: [ { id: "1", name: "Midnight 16inch MacBook Pro", price: "1999.99", sku: "MBP123-16GB-SILVER-13", inventoryQuantity: "5", weight: "1.25", weightUnit: "lb", options: [ { id: "1", name: "Color", value: "Silver", }, { id: "1", name: "Color", value: "Silver", }, { id: "1", name: "Color", value: "Silver", }, ], images: [ { id: "12345", url: "https://example.com/macbook-pro.jpg", }, { id: "12345", url: "https://example.com/macbook-pro.jpg", }, ], }, ], tags: [ "Apple", ], categories: [ { id: "12345", name: "Laptops", }, { id: "12345", name: "Laptops", }, { id: "12345", name: "Laptops", }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), updatedAt: new Date("2020-09-30T07:43:32.000Z"), }, ], meta: { itemsOnPage: 50, cursors: { previous: "em9oby1jcm06OnBhZ2U6OjE=", current: "em9oby1jcm06OnBhZ2U6OjI=", next: "em9oby1jcm06OnBhZ2U6OjM=", }, }, links: { previous: "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D", current: "https://unify.apideck.com/crm/companies", next: "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM", }, }); }); test("Products Ecommerce Products One", async () => { const testHttpClient = createTestHTTPClient("ecommerce.productsOne"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.ecommerce.products.get({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getProductResponse).toBeDefined(); expect(result.getProductResponse).toEqual({ statusCode: 200, status: "OK", service: "shopify", resource: "products", operation: "one", data: { id: "12345", name: "MacBook Pro", description: "Powerful and portable, the MacBook Pro is perfect for professionals and creatives.", status: "active", price: "1999.99", sku: "MBP123", inventoryQuantity: "10", images: [ { id: "12345", url: "https://example.com/macbook-pro.jpg", }, { id: "12345", url: "https://example.com/macbook-pro.jpg", }, { id: "12345", url: "https://example.com/macbook-pro.jpg", }, ], weight: "1.25", weightUnit: "lb", options: [ { id: "1", name: "Color", values: [ "Red", ], }, { id: "1", name: "Color", values: [ "Red", ], }, ], variants: [ { id: "1", name: "Midnight 16inch MacBook Pro", price: "1999.99", sku: "MBP123-16GB-SILVER-13", inventoryQuantity: "5", weight: "1.25", weightUnit: "lb", options: [ { id: "1", name: "Color", value: "Silver", }, { id: "1", name: "Color", value: "Silver", }, ], images: [ { id: "12345", url: "https://example.com/macbook-pro.jpg", }, { id: "12345", url: "https://example.com/macbook-pro.jpg", }, { id: "12345", url: "https://example.com/macbook-pro.jpg", }, ], }, { id: "1", name: "Midnight 16inch MacBook Pro", price: "1999.99", sku: "MBP123-16GB-SILVER-13", inventoryQuantity: "5", weight: "1.25", weightUnit: "lb", options: [ { id: "1", name: "Color", value: "Silver", }, { id: "1", name: "Color", value: "Silver", }, ], images: [ { id: "12345", url: "https://example.com/macbook-pro.jpg", }, { id: "12345", url: "https://example.com/macbook-pro.jpg", }, ], }, ], tags: [ "Apple", ], categories: [ { id: "12345", name: "Laptops", }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), updatedAt: new Date("2020-09-30T07:43:32.000Z"), }, }); });