Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
mymmrac committed Oct 30, 2024
1 parent 5997da2 commit b116bd1
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions bot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,23 @@ func TestBot_Logger(t *testing.T) {
}

func TestBot_FileDownloadURL(t *testing.T) {
bot, err := NewBot(token)
require.NoError(t, err)
t.Run("regular", func(t *testing.T) {
bot, err := NewBot(token)
require.NoError(t, err)

filepath := "file.txt"
url := bot.FileDownloadURL(filepath)
assert.Equal(t, bot.apiURL+"/file"+botPathPrefix+bot.token+"/"+filepath, url)
filepath := "file.txt"
url := bot.FileDownloadURL(filepath)
assert.Equal(t, bot.apiURL+"/file"+botPathPrefix+bot.token+"/"+filepath, url)
})

t.Run("test", func(t *testing.T) {
bot, err := NewBot(token, WithTestServerPath())
require.NoError(t, err)

filepath := "file.txt"
url := bot.FileDownloadURL(filepath)
assert.Equal(t, bot.apiURL+"/file"+botPathPrefix+bot.token+"/test/"+filepath, url)
})
}

type testErrorMarshal struct {
Expand Down

0 comments on commit b116bd1

Please sign in to comment.