feat: enhance cart functionality with quantity update and removal features, integrating toast notifications for user feedback

This commit is contained in:
2026-07-02 10:38:26 -03:00
parent f2cc42e0cc
commit c9d8265790
5 changed files with 91 additions and 13 deletions

View File

@@ -7,6 +7,7 @@ import { of } from 'rxjs';
import { Tenant } from '../../services/tenant.interface';
import { TenantService } from '../../services/tenant.service';
import { CartService } from '../../services/cart/cart.service';
import { ToastService } from '../../services/toast.service';
import { StoreLayoutComponent } from './store-layout.component';
const tenant: Tenant = {
@@ -45,7 +46,19 @@ describe('StoreLayoutComponent', () => {
provide: CartService,
useValue: {
cart: signal(null).asReadonly(),
loadCart: () => of({ id: 1, items: [], subtotal: '0' })
loadCart: () => of({ id: 1, items: [], subtotal: '0' }),
updateItemQuantity: vi.fn().mockReturnValue(of({ data: { id: 1, items: [], subtotal: '0' } })),
removeItem: vi.fn().mockReturnValue(of({ data: { id: 1, items: [], subtotal: '0' } }))
}
},
{
provide: ToastService,
useValue: {
show: vi.fn(),
info: vi.fn(),
danger: vi.fn(),
success: vi.fn(),
dismiss: vi.fn()
}
}
]