import { describe, expect, it } from 'vitest'
import {
  applyToCart,
  cartReduce,
  CartValidationError,
  groupByVendor,
  isCartValidationError,
  isMixedCurrencyError,
  MixedCurrencyError,
} from './index.js'

describe('@platform-modules/commerce-cart public barrel', () => {
  it('exports every named core symbol', () => {
    expect(typeof applyToCart).toBe('function')
    expect(typeof cartReduce).toBe('function')
    expect(typeof groupByVendor).toBe('function')
    expect(typeof CartValidationError).toBe('function')
    expect(typeof MixedCurrencyError).toBe('function')
    expect(typeof isCartValidationError).toBe('function')
    expect(typeof isMixedCurrencyError).toBe('function')
    expect(isCartValidationError(new CartValidationError('qty'))).toBe(true)
    expect(isMixedCurrencyError(new MixedCurrencyError('USD', 'EUR'))).toBe(true)
  })
})
