Added Section 179 Limits

This commit is contained in:
2026-06-05 05:55:43 -05:00
parent 4072695432
commit dfd999b6a9
11 changed files with 454 additions and 16 deletions

View File

@@ -911,6 +911,44 @@ async function main() {
.schedules.filter((r) => r.book === 'FEDERAL')[0].depreciation);
if (outYear1 !== 2000) throw new Error(`Out-of-window asset should get plain MACRS year-1 (2000), got ${outYear1}`);
// Section 179 limits + Enterprise Zone: the seeded 2015 limit ($500,000) caps a plain asset's
// §179, but an Enterprise Zone asset gets the +$35,000 increase, letting a larger §179 through.
const limitList = await request('/api/section-179-limits', { headers: auth });
if (!limitList.limits.some((l) => l.tax_year === 2015 && l.base_limit === 500000)) {
throw new Error('2015 §179 limit was not seeded');
}
const ezList = await request('/api/depreciation-zones', { headers: auth });
const ez = ezList.zones.find((z) => z.code === 'enterprise_zone');
if (!ez || ez.section_179_increase !== 35000 || ez.section_179_cost_factor !== 0.5) {
throw new Error('Enterprise Zone was not seeded with the §179 increase/cost factor');
}
// Plain asset (no zone): §179 entered 520k is capped at the 500k base limit. Straight-line, 5yr,
// half-year → basis 100k, year-1 SL 10k → year-1 = 500000 + 10000 = 510000.
const s179Plain = await request('/api/assets', {
method: 'POST', headers: auth,
body: JSON.stringify({
asset_id: `S179-${suffix}`, description: '§179 capped', category: 'Computer Equipment',
acquisition_cost: 600000, in_service_date: '2015-01-01', useful_life_months: 60,
books: [{ book_type: 'FEDERAL', active: true, depreciation_method: 'straight_line', convention: 'half_year', useful_life_months: 60, section_179_amount: 520000, cost: 600000 }]
})
});
const plainY1 = round((await request(`/api/assets/${s179Plain.asset.id}/depreciation?startYear=2015&endYear=2015`, { headers: auth }))
.schedules.filter((r) => r.book === 'FEDERAL')[0].depreciation);
if (plainY1 !== 510000) throw new Error(`§179 should cap at the 500k base limit (year-1 510000), got ${plainY1}`);
// Enterprise Zone asset: limit 500k + 35k = 535k, so the full 520k §179 applies. basis 80k,
// year-1 SL 8k → year-1 = 520000 + 8000 = 528000.
const s179Ez = await request('/api/assets', {
method: 'POST', headers: auth,
body: JSON.stringify({
asset_id: `S179EZ-${suffix}`, description: '§179 enterprise zone', category: 'Computer Equipment',
acquisition_cost: 600000, in_service_date: '2015-01-01', useful_life_months: 60, special_zone: 'enterprise_zone',
books: [{ book_type: 'FEDERAL', active: true, depreciation_method: 'straight_line', convention: 'half_year', useful_life_months: 60, section_179_amount: 520000, cost: 600000 }]
})
});
const ezY1 = round((await request(`/api/assets/${s179Ez.asset.id}/depreciation?startYear=2015&endYear=2015`, { headers: auth }))
.schedules.filter((r) => r.book === 'FEDERAL')[0].depreciation);
if (ezY1 !== 528000) throw new Error(`Enterprise Zone §179 increase should allow 520k (year-1 528000), got ${ezY1}`);
// Disposal: preview gain/loss, then record a full disposal.
const disposalAsset = await request('/api/assets', {
method: 'POST',