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

Function enableDailyChatUsageLimit

coderd/exp_chats_test.go:242–262  ·  view source on GitHub ↗
(
	ctx context.Context,
	t *testing.T,
	db database.Store,
	limitMicros int64,
)

Source from the content-addressed store, hash-verified

240}
241
242func enableDailyChatUsageLimit(
243 ctx context.Context,
244 t *testing.T,
245 db database.Store,
246 limitMicros int64,
247) time.Time {
248 t.Helper()
249
250 _, err := db.UpsertChatUsageLimitConfig(
251 dbauthz.AsSystemRestricted(ctx),
252 database.UpsertChatUsageLimitConfigParams{
253 Enabled: true,
254 DefaultLimitMicros: limitMicros,
255 Period: string(codersdk.ChatUsageLimitPeriodDay),
256 },
257 )
258 require.NoError(t, err)
259
260 _, periodEnd := chatd.ComputeUsagePeriodBounds(time.Now(), codersdk.ChatUsageLimitPeriodDay)
261 return periodEnd
262}
263
264func insertAssistantCostMessage(
265 t *testing.T,

Callers 5

TestPostChatsFunction · 0.85
TestPostChatMessagesFunction · 0.85
TestPatchChatMessageFunction · 0.85
TestRegenerateChatTitleFunction · 0.85

Calls 4

AsSystemRestrictedFunction · 0.92
ComputeUsagePeriodBoundsFunction · 0.92
HelperMethod · 0.65

Tested by

no test coverage detected