test: add unit tests for DAOs

This commit is contained in:
2026-01-18 18:36:34 -03:00
parent e125fb6e64
commit dfacc39e57
9 changed files with 420 additions and 38 deletions

View File

@@ -5,6 +5,7 @@ import { ProductEstablishment } from '../models/ProductEstablisment';
import { Chain } from '../models/Chain';
import { DBProductEstablishment } from '../models/db/DBProductEstablishment';
import { ComposedDAO } from './ComposedDAO';
import { ProductEstablishmentQueryResult } from '../types/sqlite.type';
@Injectable({
providedIn: 'root',
@@ -23,7 +24,7 @@ export class ProductEstablishmentDAO extends ComposedDAO<
JOIN product p ON p.id = pe.product_id
JOIN establishment e ON e.id = pe.establishment_id
JOIN chain c ON c.id = e.chain_id;`,
'pe'
'pe',
);
}
@@ -40,16 +41,3 @@ export class ProductEstablishmentDAO extends ComposedDAO<
return new ProductEstablishment(product, establishment, qR.id);
}
}
type ProductEstablishmentQueryResult = {
address: string;
barcode: string;
chain_id: number;
chain_image: string | null;
chain_name: string;
establishment_id: number;
id: number;
product_id: number;
product_image: string | null;
product_name: string;
};