Fix failing tests

bot-api-6.1
Henner 2017-10-07 17:53:50 +02:00
parent 5f5f94047c
commit c697a95948
1 changed files with 4 additions and 0 deletions

View File

@ -34,6 +34,7 @@ func TestMessageTime(t *testing.T) {
func TestMessageIsCommandWithCommand(t *testing.T) { func TestMessageIsCommandWithCommand(t *testing.T) {
message := tgbotapi.Message{Text: "/command"} message := tgbotapi.Message{Text: "/command"}
message.Entities = &[]tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 8}}
if message.IsCommand() != true { if message.IsCommand() != true {
t.Fail() t.Fail()
@ -58,6 +59,7 @@ func TestIsCommandWithEmptyText(t *testing.T) {
func TestCommandWithCommand(t *testing.T) { func TestCommandWithCommand(t *testing.T) {
message := tgbotapi.Message{Text: "/command"} message := tgbotapi.Message{Text: "/command"}
message.Entities = &[]tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 8}}
if message.Command() != "command" { if message.Command() != "command" {
t.Fail() t.Fail()
@ -82,6 +84,7 @@ func TestCommandWithNonCommand(t *testing.T) {
func TestCommandWithBotName(t *testing.T) { func TestCommandWithBotName(t *testing.T) {
message := tgbotapi.Message{Text: "/command@testbot"} message := tgbotapi.Message{Text: "/command@testbot"}
message.Entities = &[]tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 16}}
if message.Command() != "command" { if message.Command() != "command" {
t.Fail() t.Fail()
@ -90,6 +93,7 @@ func TestCommandWithBotName(t *testing.T) {
func TestMessageCommandArgumentsWithArguments(t *testing.T) { func TestMessageCommandArgumentsWithArguments(t *testing.T) {
message := tgbotapi.Message{Text: "/command with arguments"} message := tgbotapi.Message{Text: "/command with arguments"}
message.Entities = &[]tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 8}}
if message.CommandArguments() != "with arguments" { if message.CommandArguments() != "with arguments" {
t.Fail() t.Fail()
} }