Skip to content

Commit

Permalink
feat: add another client-id test
Browse files Browse the repository at this point in the history
  • Loading branch information
1995parham committed Oct 23, 2024
1 parent 16a454c commit c6ef683
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions internal/clientid/clientid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
"github.com/stretchr/testify/require"
)

func TestParser(t *testing.T) {
func TestParser1(t *testing.T) {
t.Parallel()

require := require.New(t)

p := clientid.NewParser(clientid.Config{
Patterns: map[string]string{
"android": "^android_\\d+$",
"android": `^android_\d+$`,
},
})

Expand All @@ -23,3 +23,17 @@ func TestParser(t *testing.T) {
require.Equal("-", p.Parse("hello"))
require.Equal("-", p.Parse("_android_124"))
}

func TestParser2(t *testing.T) {
t.Parallel()

require := require.New(t)

p := clientid.NewParser(clientid.Config{
Patterns: map[string]string{
"android_driver": `^AD#([a-f\d]{1,32}|[A-F\d]{1,32})#\d+$`,
},
})

require.Equal("android_driver", p.Parse("AD#e7adbbd4022e6ae762aae11b0593236#79971153921523"))
}

0 comments on commit c6ef683

Please sign in to comment.