test(checkout): cover cart restoration before editing

This commit is contained in:
2026-08-20 16:30:09 -03:00
parent d636b2b82b
commit b14f34d3e8

View File

@@ -537,7 +537,7 @@ describe('CheckoutPageComponent payment validation', () => {
expect(component.isEditingItems()).toBe(false);
});
it('shows Modificar and returns to the home cart when checkout editing is disabled', async () => {
it('shows Modificar, restores the previous cart and opens it when checkout editing is disabled', async () => {
tenantState.set({
codigo: 'tenant-test',
checkout_editing_policy: {
@@ -586,6 +586,10 @@ describe('CheckoutPageComponent payment validation', () => {
expect(component.canModifyCart()).toBe(false);
expect(component.isEditingItems()).toBe(false);
expect(checkoutServiceStub.prepareItemEditing).not.toHaveBeenCalled();
expect(checkoutServiceStub.cancelPurchase).toHaveBeenCalledWith('tenant-test', 25);
expect(cartServiceStub.loadCart).toHaveBeenCalled();
expect(component.createdPurchaseId()).toBeNull();
expect(component.createdPurchase()).toBeNull();
expect(routerStub.navigate).toHaveBeenCalledWith(['/'], {
queryParams: { openCart: true },
});