Compare commits
3 Commits
refactor/p
...
7ebf383c89
| Author | SHA1 | Date | |
|---|---|---|---|
| 7ebf383c89 | |||
| c14f740dbb | |||
| 3ab73a395a |
@@ -191,24 +191,25 @@ describe('CheckoutPageComponent payment validation', () => {
|
|||||||
expect(checkoutServiceStub.getPurchase).not.toHaveBeenCalled();
|
expect(checkoutServiceStub.getPurchase).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each(['created', 'pending_payment', 'in_review'])(
|
it('checks a transfer once and redirects to purchase status while pending', async () => {
|
||||||
'shows the payment error when a transfer remains %s',
|
const { component } = createComponent();
|
||||||
async (status) => {
|
component.selectedPaymentMethod.set('transfer');
|
||||||
checkoutServiceStub.submitPurchaseForReview.mockResolvedValue({ status });
|
|
||||||
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);
|
await vi.advanceTimersByTimeAsync(30_000);
|
||||||
expect(component.transferValidationStatus()).toBe('error');
|
expect(checkoutServiceStub.getPurchase).toHaveBeenCalledTimes(1);
|
||||||
expect(cartServiceStub.clearCart).not.toHaveBeenCalled();
|
|
||||||
expect(routerStub.navigate).not.toHaveBeenCalled();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
it('submits a paid transfer and navigates to its confirmation page', async () => {
|
await component.onComplete();
|
||||||
checkoutServiceStub.submitPurchaseForReview.mockResolvedValue({ status: 'paid' });
|
expect(checkoutServiceStub.getPurchase).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('navigates after a transfer is confirmed as paid', async () => {
|
||||||
|
checkoutServiceStub.getPurchase.mockResolvedValue({ status: 'paid' });
|
||||||
const { component } = createComponent();
|
const { component } = createComponent();
|
||||||
component.selectedPaymentMethod.set('transfer');
|
component.selectedPaymentMethod.set('transfer');
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<label class="visually-hidden" for="login-password">Contraseña</label>
|
<label class="visually-hidden" for="login-password">Contraseña</label>
|
||||||
<app-input
|
<app-input
|
||||||
id="login-password"
|
id="login-password"
|
||||||
type="password"
|
type="password-toggle"
|
||||||
placeholder="Contraseña"
|
placeholder="Contraseña"
|
||||||
[value]="form.controls.password.value"
|
[value]="form.controls.password.value"
|
||||||
[invalid]="showControlError('password')"
|
[invalid]="showControlError('password')"
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
(click)="togglePasswordVisibility()"
|
(click)="togglePasswordVisibility()"
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
class="fa-solid"
|
class="fa-regular"
|
||||||
[ngClass]="isPasswordVisible() ? 'fa-eye' : 'fa-eye-slash'"
|
[ngClass]="isPasswordVisible() ? 'fa-eye' : 'fa-eye-slash'"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
></i>
|
></i>
|
||||||
|
|||||||
Reference in New Issue
Block a user