forked from eatvio/eatvio_app
feat(sbp_payments): added tests for new chosen_plan_state fixtures and new tests for chat repo and service
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user