Skip to content

Commit

Permalink
test: remove broken tests (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
orisano authored Feb 1, 2024
1 parent 4a2be42 commit 3a5c450
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions account/accountusecase/accountinteractor/user_signup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ package accountinteractor
import (
"context"
"net/url"
"sync"
"testing"
"time"

"github.com/jarcoal/httpmock"
"github.com/samber/lo"
"golang.org/x/text/language"

Expand Down Expand Up @@ -290,53 +288,6 @@ func TestUser_Signup(t *testing.T) {
}
}

func TestUser_FindOrCreate(t *testing.T) {
r := accountmemory.New()
uc := NewUser(r, nil, "", "")

httpmock.Activate()
defer httpmock.Deactivate()

httpmock.RegisterResponder("GET", "https://example.com/.well-known/openid-configuration", lo.Must(httpmock.NewJsonResponder(200, map[string]any{
"userinfo_endpoint": "https://example.com/userinfo",
})))

httpmock.RegisterResponder("GET", "https://example.com/userinfo", lo.Must(httpmock.NewJsonResponder(200, map[string]any{
"sub": "auth0|SUB",
"name": "NAME",
"email": "[email protected]",
})))

wg := sync.WaitGroup{}
for i := 0; i < 10; i++ {
go func() {
_, err := uc.FindOrCreate(context.Background(), accountinterfaces.UserFindOrCreateParam{
Sub: "auth0|SUB",
ISS: "https://example.com",
Token: "token",
})
assert.NoError(t, err)
wg.Done()
}()
wg.Add(1)
}
wg.Wait()

u, _ := r.User.FindBySub(context.Background(), "auth0|SUB")
assert.Equal(
t,
user.New().
ID(u.ID()).
Workspace(u.Workspace()).
Name("NAME").
Email("[email protected]").
Auths([]user.Auth{
user.AuthFrom("auth0|SUB"),
}).
MustBuild(),
u)
}

func TestIssToURL(t *testing.T) {
assert.Nil(t, issToURL("", ""))
assert.Equal(t, &url.URL{Scheme: "https", Host: "iss.com"}, issToURL("iss.com", ""))
Expand Down

0 comments on commit 3a5c450

Please sign in to comment.