-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathjwks_helpers_test.go
More file actions
45 lines (35 loc) · 1.29 KB
/
jwks_helpers_test.go
File metadata and controls
45 lines (35 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// @oagen-ignore-file
package workos_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/workos/workos-go/v9"
)
func TestGetJWKSURL_BuildsCorrectURL(t *testing.T) {
result := workos.GetJWKSURL("https://api.workos.com", "client_123")
require.Equal(t, "https://api.workos.com/sso/jwks/client_123", result)
}
func TestGetJWKSURL_UsesDefaultBaseURL(t *testing.T) {
result := workos.GetJWKSURL("", "client_456")
require.Equal(t, "https://api.workos.com/sso/jwks/client_456", result)
}
func TestGetJWKSURL_CustomBaseURL(t *testing.T) {
result := workos.GetJWKSURL("https://custom.workos.dev", "client_789")
require.Equal(t, "https://custom.workos.dev/sso/jwks/client_789", result)
}
func TestJWKSURLFromClient_UsesClientConfig(t *testing.T) {
client := workos.NewClient("sk_test",
workos.WithClientID("client_abc"),
workos.WithBaseURL("https://api.workos.com"),
)
result := client.JWKSURLFromClient()
require.Equal(t, "https://api.workos.com/sso/jwks/client_abc", result)
}
func TestJWKSURLFromClient_CustomBaseURL(t *testing.T) {
client := workos.NewClient("sk_test",
workos.WithClientID("client_def"),
workos.WithBaseURL("https://staging.workos.dev"),
)
result := client.JWKSURLFromClient()
require.Equal(t, "https://staging.workos.dev/sso/jwks/client_def", result)
}