MCPcopy Create free account
hub / github.com/castai/openwebui-content-sync / TestIsTextFile

Function TestIsTextFile

internal/adapter/github_test.go:94–136  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

92}
93
94func TestIsTextFile(t *testing.T) {
95 tests := []struct {
96 filename string
97 expected bool
98 }{
99 {"test.md", true},
100 {"test.txt", true},
101 {"test.go", true},
102 {"test.py", true},
103 {"test.js", true},
104 {"test.ts", true},
105 {"test.json", true},
106 {"test.yaml", true},
107 {"test.yml", true},
108 {"test.xml", true},
109 {"test.html", true},
110 {"test.css", true},
111 {"test.sh", true},
112 {"test.dockerfile", true},
113 {"test.gitignore", true},
114 {"test.env", true},
115 {"test.png", false},
116 {"test.jpg", false},
117 {"test.jpeg", false},
118 {"test.gif", false},
119 {"test.exe", false},
120 {"test.dll", false},
121 {"test.so", false},
122 {"test.dylib", false},
123 {"test", true}, // No extension should be considered text
124 {"test.TXT", true}, // Case insensitive
125 {"test.MD", true}, // Case insensitive
126 }
127
128 for _, test := range tests {
129 t.Run(test.filename, func(t *testing.T) {
130 result := isTextFile(test.filename)
131 if result != test.expected {
132 t.Errorf("isTextFile(%s) = %v, expected %v", test.filename, result, test.expected)
133 }
134 })
135 }
136}
137
138func TestGitHubAdapter_FetchFiles(t *testing.T) {
139 // This test would require mocking the GitHub API

Callers

nothing calls this directly

Calls 1

isTextFileFunction · 0.85

Tested by

no test coverage detected