@@ -170,3 +170,28 @@ func TestGlobWithWerfIncYaml(t *testing.T) {
170170 require .Len (t , result , 1 )
171171 require .Equal (t , "root module yaml" , result ["werf.yaml" ])
172172}
173+
174+ func TestExists (t * testing.T ) {
175+ rootDir , moduleDir , cleanup := setupTestEnvironment (t )
176+ defer cleanup ()
177+
178+ f := NewFiles (rootDir , moduleDir )
179+
180+ // Test existing files
181+ require .True (t , f .Exists ("test.txt" ), "existing file test.txt should return true" )
182+ require .True (t , f .Exists ("dir1/file1.txt" ), "existing file dir1/file1.txt should return true" )
183+ require .True (t , f .Exists ("werf.yaml" ), "existing file werf.yaml should return true" )
184+
185+ // Test non-existing files
186+ require .False (t , f .Exists ("non-existent.txt" ), "non-existent file should return false" )
187+ require .False (t , f .Exists ("dir1/non-existent.txt" ), "non-existent file in existing dir should return false" )
188+ require .False (t , f .Exists ("non-existent-dir/file.txt" ), "file in non-existent dir should return false" )
189+
190+ // Test special case for base_images.yml
191+ require .False (t , f .Exists ("base_images.yml" ), "base_images.yml should return false when file doesn't exist" )
192+ require .False (t , f .Exists ("base_images.yaml" ), "base_images.yaml should return false when file doesn't exist" )
193+
194+ // Test directories (should return false)
195+ require .False (t , f .Exists ("dir1" ), "directory should return false" )
196+ require .False (t , f .Exists ("dir3" ), "directory should return false" )
197+ }
0 commit comments