Files
accounted/lib/tax/__tests__/expense-warnings.test.ts
T
Jakob WennbergandClaude Fable 5 826513b4fd fix(tax): representation meal warning inverted the 2017 VAT rule (#313) (#1106)
The restaurant/lunch warning claimed 'Momsen är inte avdragsgill sedan
2017', which is legally backwards. The 2017 reform (Prop. 2016/17:1)
abolished the income-tax deduction for representation meals (IL 16 kap
2 §) but retained the VAT deduction on a base of up to 300 SEK per
person excl. VAT, now ML 2023:200 13 kap 24-25 §§. The old 'ML 8:9'
citation pointed at the repealed ML 1994:200.

Verified against the swedish-vat compliance skill before rewording.
Adds regression tests pinning the corrected message and legalBasis.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-22 18:09:18 +02:00

41 lines
2.1 KiB
TypeScript

import { describe, it, expect } from 'vitest'
import { checkExpenseWarnings } from '../expense-warnings'
describe('checkExpenseWarnings: representation meals', () => {
it('states that the VAT deduction is retained on a 300 kr/person base (2017 reform inverted this before, issue #313)', () => {
const warnings = checkExpenseWarnings('Lunch med kund på restaurang')
const representation = warnings.find((w) => w.category === 'Representation')
expect(representation).toBeDefined()
expect(representation!.warningLevel).toBe('warning')
expect(representation!.message).toBe(
'Måltider kan vara avdragsgilla som representation. Inkomstskatteavdraget togs bort 2017, men momsen är avdragsgill på upp till 300 kr/person (exkl. moms) enligt ML 13 kap 24-25 §§.'
)
expect(representation!.legalBasis).toBe('IL 16 kap 2 §, ML 13 kap 24-25 §§')
})
it('never claims the VAT deduction was abolished and never cites the repealed ML 1994:200 chapter', () => {
const warnings = checkExpenseWarnings('Middag på restaurang')
const representation = warnings.find((w) => w.category === 'Representation')
expect(representation).toBeDefined()
// The pre-fix text said 'Momsen är inte avdragsgill sedan 2017', which is
// legally inverted: Prop. 2016/17:1 abolished the income-tax deduction but
// retained the VAT deduction (now ML 2023:200, 13 kap 24-25 §§).
expect(representation!.message).not.toMatch(/momsen är inte avdragsgill/i)
expect(representation!.legalBasis).not.toMatch(/ML 8:9/)
})
it('triggers on restaurant, lunch, dinner, and fika descriptions', () => {
for (const description of ['Restaurang Prinsen', 'lunch', 'middag', 'fika med teamet']) {
const warnings = checkExpenseWarnings(description)
expect(warnings.some((w) => w.category === 'Representation')).toBe(true)
}
})
it('does not trigger the representation warning for unrelated descriptions', () => {
const warnings = checkExpenseWarnings('Adobe software subscription')
expect(warnings.some((w) => w.category === 'Representation')).toBe(false)
})
})