// TestOsStatError checks that an error is returned if os.Stat fails for
// any reason.
TestOsStatError checks that an error is returned if os.Stat fails for
any reason.
// TestOsStatError checks that an error is returned if os . Stat fails for // any reason .
func TestOsStatError(t *testing.T) {
	mockError := errors.New("mocked")
	osStat = func(string) (os.FileInfo, error) {
		return nil, mockError
	}
	defer func() {
		osStat = os.Stat
	}()
	tempDir := t.TempDir()
	_, err := NewFileBrowser(tempDir, imageExtensions)
	want := fmt.Errorf("Couldn't initialize file browser for %q: %w", tempDir, mockError)
	if err.Error() != want.Error() {
		t.Errorf(`err = %v, want %v`, err, want)
	}
}
func TestOsStatError ( t * testing . T ) { mockError := errors . New ( " " ) osStat = func ( string ) ( os . FileInfo , error ) { return nil , mockError } defer func ( ) { osStat = os . Stat } ( ) tempDir := t . TempDir ( ) _ , err := NewFileBrowser ( tempDir , imageExtensions ) want := fmt . Errorf ( " " , tempDir , mockError ) if err . Error ( ) != want . Error ( ) { t . Errorf ( `err = %v, want %v` , err , want ) } }
TestOsStatError checks that an error is returned if os.Stat fails for
any reason.
TestOsStatError checks that an error is returned if os . Stat fails for any reason .