Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
test(unit): fix class schedule test
Browse files Browse the repository at this point in the history
  • Loading branch information
ditsuke committed Nov 4, 2022
1 parent 892d05a commit b9d28c9
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions amizone/internal/models/class_schedule_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package models_test

import (
"github.com/ditsuke/go-amizone/amizone/internal/models"
. "github.com/onsi/gomega"
"testing"
"time"

"github.com/ditsuke/go-amizone/amizone/internal/models"
. "github.com/onsi/gomega"
)

func TestClassSchedule_Sort(t *testing.T) {
Expand Down Expand Up @@ -34,6 +35,7 @@ func TestClassSchedule_Sort(t *testing.T) {
}

func TestClassSchedule_FilterByDate(t *testing.T) {
now := time.Date(2022, 07, 18, 11, 15, 0, 0, time.UTC)
testCases := []struct {
name string
schedule models.ClassSchedule
Expand All @@ -43,19 +45,19 @@ func TestClassSchedule_FilterByDate(t *testing.T) {
{
name: "2 classes - one is on a past date",
schedule: models.ClassSchedule{
{StartTime: time.Now()},
{StartTime: time.Now().Add(-1 * time.Hour * 24)},
{StartTime: now},
{StartTime: now.Add(-1 * time.Hour * 24)},
},
filterDate: time.Now(),
filterDate: now,
expectedLen: 1,
},
{
name: "2 classes - one is on a future date",
schedule: models.ClassSchedule{
{StartTime: time.Now()},
{StartTime: time.Now().Add(1 * time.Hour * 24)},
{StartTime: now},
{StartTime: now.Add(1 * time.Hour * 24)},
},
filterDate: time.Now(),
filterDate: now,
expectedLen: 1,
},
}
Expand Down

0 comments on commit b9d28c9

Please sign in to comment.