import { readFileSync } from 'node:fs'; import { join } from 'node:path'; import { describe, expect, it } from 'vitest'; import { INSPECTION_TASK_DISPLAY_SELECT, INSPECTION_TASK_JOINS } from '../src/services/inspectionTaskQuery'; describe('inspection task query category_name', () => { it('lateral oi exposes category_name for display SELECT', () => { expect(INSPECTION_TASK_JOINS).toContain('oi2.category_name'); expect(INSPECTION_TASK_DISPLAY_SELECT).toContain('oi.category_name'); expect(INSPECTION_TASK_DISPLAY_SELECT).toContain('AS delivery_date'); expect(INSPECTION_TASK_JOINS).toContain('insp_ord'); const src = readFileSync(join(__dirname, '../src/services/inspectionTaskQuery.ts'), 'utf8'); const lateralStart = src.indexOf('SELECT oi2.item_name'); const lateral = src.slice(lateralStart, src.indexOf(') oi ON', lateralStart)); expect(lateral).toContain('oi2.category_name'); }); });