import { describe, expect, it } from 'vitest'
import * as catalog from './index.js'

describe('@platform-modules/commerce-catalog public barrel', () => {
  it('exports every named public symbol', () => {
    for (const name of [
      'ProductValidationError',
      'NoPriceForCurrencyError',
      'ImmutableFieldError',
      'isProductValidationError',
      'isNoPriceForCurrencyError',
      'isImmutableFieldError',
      'CatalogMigrateError',
      'isCatalogMigrateError',
      'pushSchema',
      'resolvePrice',
      'getProductBySlug',
      'getProductById',
      'listProducts',
      'upsertProduct',
      'setVariantPrices',
      'setProductStatus',
      'product',
      'variant',
      'variantPrice',
      'category',
      'collection',
      'productCategory',
      'productCollection',
      'catalogSchema',
    ]) {
      expect(catalog, `missing export: ${name}`).toHaveProperty(name)
      expect((catalog as Record<string, unknown>)[name], `${name} is undefined`).toBeDefined()
    }
  })
})
