Skip to content

Commit

Permalink
add keyboard tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abbasudo committed Oct 19, 2023
1 parent 18394f3 commit 74e1794
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/Feature/TelegramMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,24 @@
$message = TelegramMessage::create()->options(['disable_web_page_preview' => true]);
expect($message->getPayloadValue('disable_web_page_preview'))->toBeTrue();
});

test('an normal keyboard button can be added to the message', function () {
$message = TelegramMessage::create()->keyboard('Laravel');
expect($message->getPayloadValue('reply_markup'))->toEqual(
'{"keyboard":[[{"text":"Laravel","request_contact":false,"request_location":false}]],"one_time_keyboard":true,"resize_keyboard":true}'
);
});

test('an request phone keyboard button can be added to the message', function () {
$message = TelegramMessage::create()->keyboard('Laravel', request_contact: true);
expect($message->getPayloadValue('reply_markup'))->toEqual(
'{"keyboard":[[{"text":"Laravel","request_contact":true,"request_location":false}]],"one_time_keyboard":true,"resize_keyboard":true}'
);
});

test('an request location keyboard button can be added to the message', function () {
$message = TelegramMessage::create()->keyboard('Laravel', request_location: true);
expect($message->getPayloadValue('reply_markup'))->toEqual(
'{"keyboard":[[{"text":"Laravel","request_contact":false,"request_location":true}]],"one_time_keyboard":true,"resize_keyboard":true}'
);
});

0 comments on commit 74e1794

Please sign in to comment.