MCPcopy Index your code
hub / github.com/coder/coder / TestUserActivityInsights_BadRequest

Function TestUserActivityInsights_BadRequest

coderd/insights_test.go:361–382  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

359}
360
361func TestUserActivityInsights_BadRequest(t *testing.T) {
362 t.Parallel()
363
364 saoPaulo, err := time.LoadLocation("America/Sao_Paulo")
365 require.NoError(t, err)
366 y, m, d := time.Now().UTC().Date()
367 today := time.Date(y, m, d, 0, 0, 0, 0, saoPaulo)
368
369 // Prepare
370 client := coderdtest.New(t, &coderdtest.Options{})
371 _ = coderdtest.CreateFirstUser(t, client)
372
373 ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
374 defer cancel()
375
376 // Send insights request
377 _, err = client.UserActivityInsights(ctx, codersdk.UserActivityInsightsRequest{
378 StartTime: today,
379 EndTime: today.AddDate(0, 0, -1),
380 })
381 assert.Error(t, err, "want error for end time before start time")
382}
383
384func TestTemplateInsights_Golden(t *testing.T) {
385 t.Parallel()

Callers

nothing calls this directly

Calls 4

NewFunction · 0.92
CreateFirstUserFunction · 0.92
UserActivityInsightsMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected