Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
boozec committed Nov 20, 2023
1 parent 5579a07 commit 6ddead4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
15 changes: 3 additions & 12 deletions commands/uni_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func TestGetTimeTable(t *testing.T) {
courseName string
year int
day time.Time
curriculum string
}
tests := []struct {
name string
Expand All @@ -123,16 +124,6 @@ func TestGetTimeTable(t *testing.T) {
},
want: "",
},
{
name: "Weekday for master",
args: args{
courseType: "magistrale",
courseName: "informatica",
year: 1,
day: time.Date(2023, 11, 20, 0, 0, 0, 0, time.UTC),
},
want: `🕘`,
},
{
name: "Weekday",
args: args{
Expand All @@ -155,7 +146,7 @@ func TestGetTimeTable(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := GetTimeTable(tt.args.courseType, tt.args.courseName, tt.args.year, tt.args.day)
got, err := GetTimeTable(tt.args.courseType, tt.args.courseName, tt.args.curriculum, tt.args.year, tt.args.day)
if err != nil && !tt.error {
t.Errorf("GetTimeTable() error = %v", err)
return
Expand All @@ -173,7 +164,7 @@ func TestGetTimeTable(t *testing.T) {
func TestWeekend(t *testing.T) {

date := time.Date(2023, 3, 11, 0, 0, 0, 0, time.UTC)
result, err := GetTimeTable("laurea", "informatica", 1, date)
result, err := GetTimeTable("laurea", "informatica", "", 1, date)
if err != nil {
t.Fatalf("Error while getting timetable: %s", err)
}
Expand Down
4 changes: 3 additions & 1 deletion model/responses_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package model
import (
"reflect"
"testing"

tgbotapi "github.com/musianisamuele/telegram-bot-api"
)

func TestCommandResponse_IsEmpty(t *testing.T) {
Expand Down Expand Up @@ -160,7 +162,7 @@ func Test_makeResponse(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := makeResponse(tt.args.text, tt.args.nextCommand); !reflect.DeepEqual(got, tt.want) {
if got := makeResponse(tt.args.text, tt.args.nextCommand, tgbotapi.InlineKeyboardMarkup{}); !reflect.DeepEqual(got, tt.want) {
t.Errorf("makeResponse() = %v, want %v", got, tt.want)
}
})
Expand Down

0 comments on commit 6ddead4

Please sign in to comment.