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

Function TestViewSubsetChat

coderd/database/gentest/models_test.go:101–112  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

99}
100
101func TestViewSubsetChat(t *testing.T) {
102 t.Parallel()
103 table := reflect.TypeOf(database.ChatTable{})
104 joined := reflect.TypeOf(database.Chat{})
105
106 tableFields := allFields(table)
107 joinedFields := allFields(joined)
108 if !assert.Subset(t, fieldNames(joinedFields), fieldNames(tableFields), "table is not subset") {
109 t.Log("Some fields were added to the Chat Table without updating the 'chats_expanded' view.")
110 t.Log("See migration 000496_chat_database_foundation.up.sql to create the view.")
111 }
112}
113
114func fieldNames(fields []reflect.StructField) []string {
115 names := make([]string, len(fields))

Callers

nothing calls this directly

Calls 3

allFieldsFunction · 0.85
fieldNamesFunction · 0.85
LogMethod · 0.80

Tested by

no test coverage detected