Skip to content

Commit 0945a99

Browse files
Andrew Farriesroboquat
Andrew Farries
authored andcommitted
Update tests with new field
1 parent f07b3e6 commit 0945a99

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

components/usage/pkg/controller/reconciler_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ func TestUsageReport_CreditSummaryForTeams(t *testing.T) {
149149
}
150150

151151
func TestUsageReportConversionToDBUsageRecords(t *testing.T) {
152+
maxStopTime := time.Date(2022, 05, 31, 23, 00, 00, 00, time.UTC)
152153
teamID := uuid.New().String()
153154
teamAttributionID := db.NewTeamAttributionID(teamID)
154155
instanceId := uuid.New()
@@ -178,7 +179,7 @@ func TestUsageReportConversionToDBUsageRecords(t *testing.T) {
178179
AttributionID: teamAttributionID,
179180
StartedAt: creationTime.Time(),
180181
StoppedAt: sql.NullTime{Time: stoppedTime.Time(), Valid: true},
181-
CreditsUsed: 0,
182+
CreditsUsed: 470,
182183
GenerationId: 0,
183184
}},
184185
},
@@ -200,15 +201,15 @@ func TestUsageReportConversionToDBUsageRecords(t *testing.T) {
200201
AttributionID: teamAttributionID,
201202
StartedAt: creationTime.Time(),
202203
StoppedAt: sql.NullTime{},
203-
CreditsUsed: 0,
204+
CreditsUsed: 470,
204205
GenerationId: 0,
205206
}},
206207
},
207208
}
208209

209210
for _, s := range scenarios {
210211
t.Run(s.Name, func(t *testing.T) {
211-
actual := usageReportToUsageRecords(s.Report)
212+
actual := usageReportToUsageRecords(s.Report, DefaultWorkspacePricer, maxStopTime)
212213
require.Equal(t, s.Expected, actual)
213214
})
214215
}

0 commit comments

Comments
 (0)