Squashed commit of the following:
commit38d03588b1Merge:8e987d06f4aa3bAuthor: ncoronel <ncoronel@quo.ar> Date: Wed Aug 26 10:25:23 2026 -0300 Merge branch 'fix/cart-expiration-notification' of https://gitea.quo.ar/tbianchini/shopit-front into fix/cart-expiration-notification commit8e987d0ce6Author: ncoronel <ncoronel@quo.ar> Date: Wed Aug 26 10:02:26 2026 -0300 fix(purchase-status): clear cart on approved purchase commite171b9a233Author: ncoronel <ncoronel@quo.ar> Date: Tue Aug 25 17:06:07 2026 -0300 refactor(checkout): use purchase id route segment commit643d43adeaAuthor: ncoronel <ncoronel@quo.ar> Date: Tue Aug 25 17:05:59 2026 -0300 fix(checkout): handle expired purchase exits commitd89d01b511Author: ncoronel <ncoronel@quo.ar> Date: Tue Aug 25 16:47:17 2026 -0300 fix(checkout): refresh expired carts commiteeb245209bAuthor: ncoronel <ncoronel@quo.ar> Date: Tue Aug 25 16:46:12 2026 -0300 fix(checkout): show backend start errors commit9d3754c2d8Author: ncoronel <ncoronel@quo.ar> Date: Tue Aug 25 16:33:44 2026 -0300 fix(cart): refresh state after expiration commit6f4aa3b1bdAuthor: ncoronel <ncoronel@quo.ar> Date: Wed Aug 26 10:02:26 2026 -0300 fix(purchase-status): clear cart on approved purchase commit2b342ec235Author: ncoronel <ncoronel@quo.ar> Date: Tue Aug 25 17:06:07 2026 -0300 refactor(checkout): use purchase id route segment commitd06b146104Author: ncoronel <ncoronel@quo.ar> Date: Tue Aug 25 17:05:59 2026 -0300 fix(checkout): handle expired purchase exits commitf4e0a9e028Author: ncoronel <ncoronel@quo.ar> Date: Tue Aug 25 16:47:17 2026 -0300 fix(checkout): refresh expired carts commit8c2b738806Author: ncoronel <ncoronel@quo.ar> Date: Tue Aug 25 16:46:12 2026 -0300 fix(checkout): show backend start errors commit1362d0c163Author: ncoronel <ncoronel@quo.ar> Date: Tue Aug 25 16:33:44 2026 -0300 fix(cart): refresh state after expiration
This commit is contained in:
@@ -7,6 +7,7 @@ import { of } from 'rxjs';
|
||||
import { App } from './app';
|
||||
import { AuthService } from './core/services/auth/auth.service';
|
||||
import { CartService } from './core/services/cart/cart.service';
|
||||
import { CheckoutService } from './core/services/checkout.service';
|
||||
import { Tenant } from './core/services/tenant.interface';
|
||||
import { TenantService } from './core/services/tenant.service';
|
||||
import { routes } from './app.routes';
|
||||
@@ -97,6 +98,21 @@ async function renderAppAt(
|
||||
{
|
||||
provide: AuthService,
|
||||
useValue: authService
|
||||
},
|
||||
{
|
||||
provide: CheckoutService,
|
||||
useValue: {
|
||||
withCustomLoading() {
|
||||
return this;
|
||||
},
|
||||
getPurchase: vi.fn().mockResolvedValue({
|
||||
id: 25,
|
||||
status: 'created',
|
||||
items: [],
|
||||
subtotal: '0.00',
|
||||
total: '0.00'
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}).compileComponents();
|
||||
@@ -246,15 +262,33 @@ describe('app routes', () => {
|
||||
expect(compiled.textContent).toContain('No encontramos una tienda para este dominio');
|
||||
});
|
||||
|
||||
it('redirects unauthenticated users from /checkout to /login', async () => {
|
||||
const { router } = await renderAppAt('/checkout', createTenantServiceStub(), createAuthServiceStub(false));
|
||||
it('redirects unauthenticated users from /checkout/:id to /login', async () => {
|
||||
const { router } = await renderAppAt('/checkout/25', createTenantServiceStub(), createAuthServiceStub(false));
|
||||
|
||||
expect(router.url).toBe('/login?returnUrl=%2Fcheckout');
|
||||
expect(router.url).toBe('/login?returnUrl=%2Fcheckout%2F25');
|
||||
});
|
||||
|
||||
it('allows authenticated users to access /checkout', async () => {
|
||||
const { router } = await renderAppAt('/checkout', createTenantServiceStub(), createAuthServiceStub(true));
|
||||
it('allows authenticated users to access /checkout/:id', async () => {
|
||||
const checkoutTenant = {
|
||||
...tenant,
|
||||
menues: [
|
||||
{
|
||||
id: 1,
|
||||
code: 'checkout',
|
||||
label: 'Checkout',
|
||||
parent_menu_code: null,
|
||||
content_type: 'dynamic' as const,
|
||||
route: '/checkout',
|
||||
submenues: []
|
||||
}
|
||||
]
|
||||
};
|
||||
const { router } = await renderAppAt(
|
||||
'/checkout/25',
|
||||
createTenantServiceStub('ready', checkoutTenant),
|
||||
createAuthServiceStub(true)
|
||||
);
|
||||
|
||||
expect(router.url).toBe('/checkout');
|
||||
expect(router.url).toBe('/checkout/25');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user