import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; import { resolve } from 'node:path'; import test from 'node:test'; function source(path: string): string { return readFileSync(resolve(process.cwd(), path), 'utf8'); } test('F6.6 Hallazgo version capture uses a SELECT-shaped CTE so TypeORM never turns the version into NaN', () => { const service = source('src/inspection-findings/inspection-findings.service.ts'); assert.match(service, /WITH updated AS \(/); assert.match(service, /UPDATE inspection_findings/); assert.match(service, /RETURNING current_version/); assert.match(service, /SELECT current_version AS "versionNumber" FROM updated/); assert.match(service, /const versionNumber = Number\(row\.versionNumber\)/); }); test('F6.6 mobile home keeps Salir readable on narrow screens', () => { const home = source('../android-app/app/src/main/java/com/korexlabs/dhinspeccion/ui/MobileHomeScreen.kt'); assert.match(home, /Text\("Actualizar", maxLines = 1\)/); assert.match(home, /Text\("Salir", maxLines = 1\)/); assert.match(home, /modifier = Modifier\.weight\(1f\)/); }); test('F6.6 Hallazgos can receive as many field photos as needed', () => { const screen = source('../android-app/app/src/main/java/com/korexlabs/dhinspeccion/ui/FieldFindingScreen.kt'); const model = source('../android-app/app/src/main/java/com/korexlabs/dhinspeccion/MainViewModel.kt'); assert.match(screen, /Agregar foto con GPS/); assert.match(screen, /Agregar otra foto con GPS/); assert.match(screen, /Podés adjuntar todas las fotos que necesites/); assert.match(model, /loadEvidenceInternal\(findingId\)/); assert.doesNotMatch(screen, /máximo de 1 foto|solo una foto/i); });