MCPcopy Index your code
hub / github.com/apache/devlake / TestGetTablesInfo

Function TestGetTablesInfo

backend/plugins/gh-copilot/models/models_test.go:22–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20import "testing"
21
22func TestGetTablesInfo(t *testing.T) {
23 tables := GetTablesInfo()
24 expected := map[string]bool{
25 (&GhCopilotConnection{}).TableName(): false,
26 (&GhCopilotScope{}).TableName(): false,
27 (&GhCopilotScopeConfig{}).TableName(): false,
28 (&GhCopilotOrgMetrics{}).TableName(): false,
29 (&GhCopilotLanguageMetrics{}).TableName(): false,
30 (&GhCopilotEnterpriseDailyMetrics{}).TableName(): false,
31 (&GhCopilotMetricsByIde{}).TableName(): false,
32 (&GhCopilotMetricsByFeature{}).TableName(): false,
33 (&GhCopilotMetricsByLanguageFeature{}).TableName(): false,
34 (&GhCopilotMetricsByLanguageModel{}).TableName(): false,
35 (&GhCopilotMetricsByModelFeature{}).TableName(): false,
36 (&GhCopilotUserDailyMetrics{}).TableName(): false,
37 (&GhCopilotUserMetricsByIde{}).TableName(): false,
38 (&GhCopilotUserMetricsByFeature{}).TableName(): false,
39 (&GhCopilotUserMetricsByLanguageFeature{}).TableName(): false,
40 (&GhCopilotUserMetricsByLanguageModel{}).TableName(): false,
41 (&GhCopilotUserMetricsByModelFeature{}).TableName(): false,
42 (&GhCopilotSeat{}).TableName(): false,
43 }
44
45 if len(tables) != len(expected) {
46 t.Fatalf("unexpected number of tables: want %d, got %d", len(expected), len(tables))
47 }
48
49 for _, table := range tables {
50 tableName := table.TableName()
51 if _, ok := expected[tableName]; !ok {
52 t.Fatalf("unexpected table registered: %s", tableName)
53 }
54 expected[tableName] = true
55 }
56
57 for name, seen := range expected {
58 if !seen {
59 t.Fatalf("table not registered: %s", name)
60 }
61 }
62}

Callers

nothing calls this directly

Calls 2

GetTablesInfoFunction · 0.85
TableNameMethod · 0.65

Tested by

no test coverage detected