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

Function TestIsFile

internal/utils/helpers_test.go:109–124  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

107}
108
109func TestIsFile(t *testing.T) {
110 fs := afero.NewMemMapFs()
111 ctx := WithFS(context.Background(), fs)
112
113 testFilePath := "/test-file.txt"
114 err := afero.WriteFile(fs, testFilePath, []byte("test"), 0o644)
115 assert.NoError(t, err)
116
117 isFile, err := IsFile(ctx, testFilePath)
118 assert.True(t, isFile)
119 assert.Nil(t, err)
120
121 isFile, err = IsFile(context.Background(), "/non-existent-file.txt")
122 assert.False(t, isFile)
123 assert.Nil(t, err)
124}
125
126func TestHasJsonOrYamlExt(t *testing.T) {
127 tests := []struct {

Callers

nothing calls this directly

Calls 2

WithFSFunction · 0.85
IsFileFunction · 0.85

Tested by

no test coverage detected