Skip to content

Commit

Permalink
Chore: Add workflow_dispatch to run tests workflow & update tests to …
Browse files Browse the repository at this point in the history
…expect case insensitive email response (#19)

* Chore: Add workflow_dispatch to run tests workflow

* Chore: Fix update email tests to reflect case insenstive email response

* Chore: Update random email string to be lowercase
  • Loading branch information
macleanevans authored Aug 19, 2022
1 parent f2a3b6a commit e4363a9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Run Tests

on: [pull_request]
on:
workflow_dispatch:
pull_request:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion passage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"crypto/rand"
"fmt"
"os"
"strings"
"testing"

"github.com/joho/godotenv"
Expand All @@ -26,7 +27,7 @@ func generateRandomEmail(prefixLength int) string {
panic(err)
}
email := fmt.Sprintf("%X@email.com", randomChars)
return email
return strings.ToLower(email)
}

func TestMain(m *testing.M) {
Expand Down
8 changes: 4 additions & 4 deletions user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,28 @@ func TestUpdateUser(t *testing.T) {
require.Nil(t, err)

updateBody := passage.UpdateBody{
Email: "updatedEmail@123.com",
Email: "updatedemail-gosdk@passage.id",
Phone: "+15005550006",
UserMetadata: map[string]interface{}{
"example1": "123",
},
}
user, err := psg.UpdateUser(PassageUserID, updateBody)
require.Nil(t, err)
assert.Equal(t, "updatedEmail@123.com", user.Email)
assert.Equal(t, "updatedemail-gosdk@passage.id", user.Email)
assert.Equal(t, "+15005550006", user.Phone)
assert.Equal(t, "123", user.UserMetadata["example1"])

secondUpdateBody := passage.UpdateBody{
Email: "updatedEmail@123.com",
Email: "updatedemail-gosdk@passage.id",
Phone: "+15005550006",
UserMetadata: map[string]interface{}{
"example1": "456",
},
}
user, err = psg.UpdateUser(PassageUserID, secondUpdateBody)
require.Nil(t, err)
assert.Equal(t, "updatedEmail@123.com", user.Email)
assert.Equal(t, "updatedemail-gosdk@passage.id", user.Email)
assert.Equal(t, "+15005550006", user.Phone)
assert.Equal(t, "456", user.UserMetadata["example1"])
}
Expand Down

0 comments on commit e4363a9

Please sign in to comment.