test: improve test
gitea/salix-front/pipeline/pr-master This commit looks good Details

This commit is contained in:
Javier Segarra 2025-05-02 10:11:36 +02:00
parent 750ce68f97
commit 68e1b2ed27
1 changed files with 10 additions and 1 deletions

View File

@ -16,10 +16,19 @@ describe('getItemPackagingType', () => {
const ticketSales = [ const ticketSales = [
{ item: { itemPackingTypeFk: 'H' } }, { item: { itemPackingTypeFk: 'H' } },
{ item: { itemPackingTypeFk: 'V' } }, { item: { itemPackingTypeFk: 'V' } },
{ item: { itemPackingTypeFk: 'H' } }, // Duplicado { item: { itemPackingTypeFk: 'H' } },
]; ];
expect(getItemPackagingType(ticketSales)).toBe('H, V'); expect(getItemPackagingType(ticketSales)).toBe('H, V');
}); });
it('should return unique packaging types as a comma-separated string', () => {
const ticketSales = [
{ item: { itemPackingTypeFk: 'H' } },
{ item: { itemPackingTypeFk: 'V' } },
{ item: { itemPackingTypeFk: 'H' } },
{ item: { itemPackingTypeFk: 'A' } },
];
expect(getItemPackagingType(ticketSales)).toBe('H, V, A');
});
it('should return "-" if ticketSales is an empty array', () => { it('should return "-" if ticketSales is an empty array', () => {
expect(getItemPackagingType([])).toBe('-'); expect(getItemPackagingType([])).toBe('-');