Android CI / RC / Android · lint, tests, debug APK, release compile (push) Failing after 1m25s
DH V2 CI / API · typecheck, tests, build (push) Successful in 34s
DH V2 CI / WEB · typecheck, build (push) Successful in 20s
Production dependency audit / API · production dependencies (push) Successful in 9s
Production dependency audit / WEB · production dependencies (push) Successful in 9s
DH V2 CI / Docker / scripts contract (push) Successful in 1m16s
52 lines
2.4 KiB
TypeScript
52 lines
2.4 KiB
TypeScript
import 'reflect-metadata';
|
|
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
const userMigration = readFileSync(
|
|
'src/database/migrations/1789844700000-phase-f3-1-user-profile.ts',
|
|
'utf8',
|
|
);
|
|
const usersService = readFileSync('src/administration/users/users.service.ts', 'utf8');
|
|
const dossier = readFileSync('src/asset-master/merged-inventory-dossier.service.ts', 'utf8');
|
|
const otherMigration = readFileSync(
|
|
'src/database/migrations/1789844800000-phase-f3-1-other-inventory-families.ts',
|
|
'utf8',
|
|
);
|
|
|
|
test('F3.1 amplía el perfil personal y protege email del Inspector también en DB', () => {
|
|
assert.match(userMigration, /ADD COLUMN dni/);
|
|
assert.match(userMigration, /ADD COLUMN phone/);
|
|
assert.match(userMigration, /ADD COLUMN job_title/);
|
|
assert.match(userMigration, /ADD COLUMN employee_number/);
|
|
assert.match(userMigration, /uq_users_dni_not_null/);
|
|
assert.match(userMigration, /INSPECTOR_EMAIL_REQUIRED/);
|
|
assert.match(userMigration, /trg_user_roles_inspector_email/);
|
|
assert.match(userMigration, /trg_users_inspector_email/);
|
|
});
|
|
|
|
test('F3.1 email del Inspector sigue protegido y F6.2 endurece email para todo usuario', () => {
|
|
assert.match(usersService, /USER_EMAIL_REQUIRED/);
|
|
assert.match(usersService, /Cada usuario de Hidrocarburos debe tener un email válido/);
|
|
assert.match(usersService, /if \(!dto\.email\?\.trim\(\)\) throw userEmailRequired\(\)/);
|
|
assert.match(usersService, /dto\.email !== undefined && !dto\.email/);
|
|
});
|
|
|
|
test('F3.1 dossier canónico agrega alias sin borrar identidad histórica', () => {
|
|
assert.match(dossier, /inventoryIds = \[canonical\.id, \.\.\.aliases\.map/);
|
|
assert.match(dossier, /Promise\.all\(inventoryIds\.map/);
|
|
assert.match(dossier, /historicalInventory/);
|
|
assert.match(dossier, /kind: 'MERGE'/);
|
|
assert.match(dossier, /CHRONOLOGICAL_AGGREGATION_WITH_ORIGINAL_IDENTITY/);
|
|
assert.match(dossier, /requestedWasMerged/);
|
|
});
|
|
|
|
test('F3.1 crea familias Otro válidas y asociadas a controles universales', () => {
|
|
assert.match(otherMigration, /F31-INST-OTRO/);
|
|
assert.match(otherMigration, /Otro \/ no catalogado/);
|
|
assert.match(otherMigration, /SUBINSTALLATION/);
|
|
assert.match(otherMigration, /inventory_family_parent_rules/);
|
|
assert.match(otherMigration, /F31_UNIVERSAL_FINDINGS/);
|
|
assert.match(otherMigration, /finding_catalog_item_inventory_families/);
|
|
});
|