import { describe, it, expect } from 'bun:test' import { TaxService } from '../../src/services/tax.service.js' describe('TaxService.repairItemTypeToTaxCategory — consumable', () => { it('maps consumable to exempt', () => { expect(TaxService.repairItemTypeToTaxCategory('consumable')).toBe('exempt') }) it('maps labor to service', () => { expect(TaxService.repairItemTypeToTaxCategory('labor')).toBe('service') }) it('maps part to goods', () => { expect(TaxService.repairItemTypeToTaxCategory('part')).toBe('goods') }) it('maps flat_rate to goods', () => { expect(TaxService.repairItemTypeToTaxCategory('flat_rate')).toBe('goods') }) it('maps misc to goods', () => { expect(TaxService.repairItemTypeToTaxCategory('misc')).toBe('goods') }) it('maps unknown type to goods (default)', () => { expect(TaxService.repairItemTypeToTaxCategory('anything_else')).toBe('goods') }) }) describe('TaxService.getRateForLocation — exempt category', () => { it('returns 0 for exempt tax category without DB call', async () => { // Passing a fake DB and fake locationId — should short-circuit and return 0 const fakeDb = {} as any const rate = await TaxService.getRateForLocation(fakeDb, 'fake-id', 'exempt') expect(rate).toBe(0) }) })