import { describe, expect, it } from 'vitest'
import { orderRequiresPriceApproval } from '../order-requires-price-approval'

describe('orderRequiresPriceApproval', () => {
  it('returns true when pending payment delivery fee is not locked for delivery', () => {
    const result = orderRequiresPriceApproval({
      status: 'PENDING_PAYMENT',
      deliveryType: 'delivery',
      deliveryFeeLocked: false,
    })

    expect(result).toBe(true)
  })

  it('returns false when status is not pending payment', () => {
    const result = orderRequiresPriceApproval({
      status: 'PAID',
      deliveryType: 'delivery',
      deliveryFeeLocked: false,
    })

    expect(result).toBe(false)
  })

  it('returns false when delivery type is pickup', () => {
    const result = orderRequiresPriceApproval({
      status: 'PENDING_PAYMENT',
      deliveryType: 'pickup',
      deliveryFeeLocked: false,
    })

    expect(result).toBe(false)
  })

  it('returns false when delivery fee is locked', () => {
    const result = orderRequiresPriceApproval({
      status: 'PENDING_PAYMENT',
      deliveryType: 'delivery',
      deliveryFeeLocked: true,
    })

    expect(result).toBe(false)
  })
})
