test: guard active Act queries from removed Inspection fields
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import test from 'node:test';
|
||||
import { getMetadataArgsStorage, type QueryRunner } from 'typeorm';
|
||||
import { InspectionVisit } from '../../src/database/entities/inspection-visit.entity';
|
||||
import { F4RemoveInspectionLegacyFields1790000500000 } from '../../src/database/migrations/1790000500000-f4-remove-inspection-legacy-fields';
|
||||
|
||||
const root = process.cwd();
|
||||
|
||||
test('F4: InspectionVisit no vuelve a mapear title ni plannedEndAt', () => {
|
||||
const metadata = getMetadataArgsStorage();
|
||||
const columns = metadata.columns
|
||||
@@ -20,6 +24,12 @@ test('F4: InspectionVisit no vuelve a mapear title ni plannedEndAt', () => {
|
||||
assert.equal(indexes.includes('idx_inspection_visits_planned_start_at'), true);
|
||||
});
|
||||
|
||||
test('F4: los consumidores activos de Actas no consultan el title físico de la Inspección', () => {
|
||||
const acts = fs.readFileSync(path.join(root, 'src/inspection-acts/inspection-acts.service.ts'), 'utf8');
|
||||
assert.doesNotMatch(acts, /visit\.title/);
|
||||
assert.doesNotMatch(acts, /['"]title['"]\s*,\s*visit\.title/);
|
||||
});
|
||||
|
||||
test('F4: la migración retira las columnas legacy y conserva índice de inicio', async () => {
|
||||
const statements: string[] = [];
|
||||
const queryRunner = {
|
||||
|
||||
Reference in New Issue
Block a user