MCPcopy Create free account
hub / github.com/conforma/cli / TestInlineDataSubdir

Function TestInlineDataSubdir

internal/policy/source/source_test.go:204–237  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

202}
203
204func TestInlineDataSubdir(t *testing.T) {
205 tests := []struct {
206 name string
207 inputData []byte
208 expectedSubdir string
209 }{
210 {
211 name: "simple data returns data subdir",
212 inputData: []byte("test data"),
213 expectedSubdir: "data",
214 },
215 {
216 name: "json data returns data subdir",
217 inputData: []byte(`{"key": "value"}`),
218 expectedSubdir: "data",
219 },
220 {
221 name: "empty data returns data subdir",
222 inputData: []byte(""),
223 expectedSubdir: "data",
224 },
225 }
226
227 for _, tt := range tests {
228 t.Run(tt.name, func(t *testing.T) {
229 s := InlineData(tt.inputData)
230
231 result := s.Subdir()
232
233 assert.Equal(t, tt.expectedSubdir, result)
234 assert.Equal(t, "data", result, "Subdir should always return 'data' regardless of input")
235 })
236 }
237}
238
239func TestInlineDataGetPolicy(t *testing.T) {
240 tests := []struct {

Callers

nothing calls this directly

Calls 3

InlineDataFunction · 0.85
RunMethod · 0.65
SubdirMethod · 0.65

Tested by

no test coverage detected