Compare commits
2 Commits
refactor/p
...
c14f740dbb
| Author | SHA1 | Date | |
|---|---|---|---|
| c14f740dbb | |||
| 3ab73a395a |
@@ -191,24 +191,25 @@ describe('CheckoutPageComponent payment validation', () => {
|
||||
expect(checkoutServiceStub.getPurchase).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it.each(['created', 'pending_payment', 'in_review'])(
|
||||
'shows the payment error when a transfer remains %s',
|
||||
async (status) => {
|
||||
checkoutServiceStub.submitPurchaseForReview.mockResolvedValue({ status });
|
||||
const { component } = createComponent();
|
||||
component.selectedPaymentMethod.set('transfer');
|
||||
it('checks a transfer once and redirects to purchase status while pending', async () => {
|
||||
const { component } = createComponent();
|
||||
component.selectedPaymentMethod.set('transfer');
|
||||
|
||||
await component.onComplete();
|
||||
await component.onComplete();
|
||||
expect(checkoutServiceStub.getPurchase).toHaveBeenCalledTimes(1);
|
||||
expect(component.transferValidationStatus()).toBe('pending');
|
||||
expect(cartServiceStub.clearCart).not.toHaveBeenCalled();
|
||||
expect(routerStub.navigate).toHaveBeenCalledWith(['/checkout/status', 25]);
|
||||
|
||||
expect(checkoutServiceStub.submitPurchaseForReview).toHaveBeenCalledWith('tenant-test', 25);
|
||||
expect(component.transferValidationStatus()).toBe('error');
|
||||
expect(cartServiceStub.clearCart).not.toHaveBeenCalled();
|
||||
expect(routerStub.navigate).not.toHaveBeenCalled();
|
||||
},
|
||||
);
|
||||
await vi.advanceTimersByTimeAsync(30_000);
|
||||
expect(checkoutServiceStub.getPurchase).toHaveBeenCalledTimes(1);
|
||||
|
||||
it('submits a paid transfer and navigates to its confirmation page', async () => {
|
||||
checkoutServiceStub.submitPurchaseForReview.mockResolvedValue({ status: 'paid' });
|
||||
await component.onComplete();
|
||||
expect(checkoutServiceStub.getPurchase).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('navigates after a transfer is confirmed as paid', async () => {
|
||||
checkoutServiceStub.getPurchase.mockResolvedValue({ status: 'paid' });
|
||||
const { component } = createComponent();
|
||||
component.selectedPaymentMethod.set('transfer');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user