Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
engmtcdrm committed Nov 3, 2024
1 parent f5494c4 commit 4aaa948
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions credentials/credentials_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package credentials

import (
"os"
"testing"

"github.com/stretchr/testify/assert"
)

func TestIsValidName(t *testing.T) {
assert.True(t, IsValidName("valid_name"))
assert.True(t, IsValidName("valid-name"))
assert.True(t, IsValidName("validname123"))
assert.False(t, IsValidName("invalid name"))
assert.False(t, IsValidName("invalid/name"))
assert.False(t, IsValidName("invalid.name"))
}

func TestIsExists(t *testing.T) {
// Create test data
os.MkdirAll("./testdata", os.ModePerm)
defer os.RemoveAll("./testdata")

credFile := "./testdata/test.cred"
os.WriteFile(credFile, []byte("test"), os.ModePerm)

assert.True(t, IsExists(credFile))
assert.False(t, IsExists("./testdata/nonexistent.cred"))
}

0 comments on commit 4aaa948

Please sign in to comment.