feat(sbp_payments): added tests for new chosen_plan_state fixtures and new tests for chat repo and service

This commit is contained in:
misha
2026-07-08 15:07:36 +03:00
parent e10610d93c
commit 51397003b5
10 changed files with 171 additions and 27 deletions

View File

@@ -235,6 +235,38 @@ void main() {
verify(mockChatService.getPaymentLink(id: planId, body: {'payment_provider': 'mock'})).called(1);
});
test(
'getPaymentLink - возвращает ссылку на оплату alfa-bank',
() async {
const planId = 123;
final requestFixture = FixtureReader.readAsMap(
'chat/payments/payment_alfabank_request.json',
);
final requestBody = Map<String, String>.from(requestFixture);
final paymentFixture = FixtureReader.readAsMap(
'chat/payments/payment_response_alfa_bank.json',
);
final expectedPayment = PaymentModel.fromJson(paymentFixture);
when(
mockChatService.getPaymentLink(id: planId, body: requestBody),
).thenAnswer((_) async => expectedPayment);
final result = await mockChatService.getPaymentLink(
id: planId,
body: requestBody,
);
expect(result, isA<PaymentModel>());
expect(result.paymentUrl, 'https://qr.nspk.ru/ASDFASDFASDFASDF');
expect(result.orderId, 'alfa_c29_k15138_t1712345678_r1234');
expect(result.paymentProvider, 'alfa-bank');
verify(
mockChatService.getPaymentLink(id: planId, body: requestBody),
).called(1);
},
);
test('getChosenPlan - возвращает выбранный план', () async {
const planId = 1;
final chosenPlanFixture = FixtureReader.readAsMap(