diff --git a/database/schedule_test.go b/database/schedule_test.go index ee1a06dd..904960ba 100644 --- a/database/schedule_test.go +++ b/database/schedule_test.go @@ -25,6 +25,7 @@ func TestDatabase_ScheduleFromLibrary(t *testing.T) { s.SetUpdatedAt(time.Now().Add(time.Hour * 1).UTC().Unix()) s.SetUpdatedBy("user2") s.SetScheduledAt(time.Now().Add(time.Hour * 2).UTC().Unix()) + s.SetBranch("main") want := testSchedule() @@ -59,6 +60,7 @@ func TestDatabase_Schedule_Nullify(t *testing.T) { UpdatedAt: sql.NullInt64{Int64: 0, Valid: false}, UpdatedBy: sql.NullString{String: "", Valid: false}, ScheduledAt: sql.NullInt64{Int64: 0, Valid: false}, + Branch: sql.NullString{String: "", Valid: false}, }, }, { @@ -90,6 +92,7 @@ func TestDatabase_Schedule_ToLibrary(t *testing.T) { want.SetUpdatedAt(time.Now().Add(time.Hour * 1).UTC().Unix()) want.SetUpdatedBy("user2") want.SetScheduledAt(time.Now().Add(time.Hour * 2).UTC().Unix()) + want.SetBranch("main") got := testSchedule().ToLibrary() if !reflect.DeepEqual(got, want) { @@ -176,5 +179,6 @@ func testSchedule() *Schedule { UpdatedAt: sql.NullInt64{Int64: time.Now().Add(time.Hour * 1).UTC().Unix(), Valid: true}, UpdatedBy: sql.NullString{String: "user2", Valid: true}, ScheduledAt: sql.NullInt64{Int64: time.Now().Add(time.Hour * 2).UTC().Unix(), Valid: true}, + Branch: sql.NullString{String: "main", Valid: true}, } } diff --git a/library/schedule_test.go b/library/schedule_test.go index 9cf75313..bf953e4b 100644 --- a/library/schedule_test.go +++ b/library/schedule_test.go @@ -66,6 +66,9 @@ func TestLibrary_Schedule_Getters(t *testing.T) { if test.schedule.GetScheduledAt() != test.want.GetScheduledAt() { t.Errorf("GetScheduledAt is %v, want %v", test.schedule.GetScheduledAt(), test.want.GetScheduledAt()) } + if test.schedule.GetBranch() != test.want.GetBranch() { + t.Errorf("GetBranch is %v, want %v", test.schedule.GetBranch(), test.want.GetBranch()) + } }) } } @@ -136,6 +139,10 @@ func TestLibrary_Schedule_Setters(t *testing.T) { if test.schedule.GetScheduledAt() != test.want.GetScheduledAt() { t.Errorf("SetScheduledAt is %v, want %v", test.schedule.GetScheduledAt(), test.want.GetScheduledAt()) } + test.schedule.SetBranch(test.want.GetBranch()) + if test.schedule.GetBranch() != test.want.GetBranch() { + t.Errorf("SetBranch is %v, want %v", test.schedule.GetBranch(), test.want.GetBranch()) + } }) } } @@ -154,6 +161,7 @@ func TestLibrary_Schedule_String(t *testing.T) { ScheduledAt: %d, UpdatedAt: %d, UpdatedBy: %s, + Branch: %s, }`, s.GetActive(), s.GetCreatedAt(), @@ -165,6 +173,7 @@ func TestLibrary_Schedule_String(t *testing.T) { s.GetScheduledAt(), s.GetUpdatedAt(), s.GetUpdatedBy(), + s.GetBranch(), ) got := s.String() @@ -186,6 +195,7 @@ func testSchedule() *Schedule { s.SetUpdatedAt(time.Now().Add(time.Hour * 1).UTC().Unix()) s.SetUpdatedBy("user2") s.SetScheduledAt(time.Now().Add(time.Hour * 2).UTC().Unix()) + s.SetBranch("main") return s }