Files
htwkalender/services/data-manager/service/db/dbFunctions_test.go
2024-06-18 12:50:21 +02:00

51 lines
915 B
Go

package db
import "testing"
func TestIsSafeIdentifier(t *testing.T) {
type args struct {
uuid string
}
tests := []struct {
name string
args args
want bool
}{
{
name: "Test safe identifier",
args: args{
uuid: "1234567890-1234567890-1234567890-1234567890",
},
want: true,
},
{
name: "Test safe identifier",
args: args{
uuid: "1234567890-1234567890-1234567890-1234567890",
},
want: true,
},
{
name: "Test safe identifier",
args: args{
uuid: "77eddc32-c49d-5d0a-8c36-17b266396641",
},
want: true,
},
{
name: "Test unsafe identifier",
args: args{
uuid: "77eddc32-c49d-5d0a-8c36-17/1!!b266396641-",
},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := IsSafeIdentifier(tt.args.uuid); got != tt.want {
t.Errorf("IsSafeIdentifier() = %v, want %v", got, tt.want)
}
})
}
}