Skip to content

Commit 3646fee

Browse files
committed
feat: creds stest
1 parent 8293128 commit 3646fee

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

tests/credentials.test.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,49 +25,49 @@ describe("Credentials", () => {
2525
{
2626
description: "should use default scheme and token endpoint path when apiTokenIssuer has no scheme and no path",
2727
apiTokenIssuer: "issuer.fga.example",
28-
expectedBaseUrl: "https://issuer.fga.example",
28+
expectedBaseUrl: "https://issuer.fga.example:443",
2929
expectedPath: `/${DEFAULT_TOKEN_ENDPOINT_PATH}`,
3030
},
3131
{
3232
description: "should use default token endpoint path when apiTokenIssuer has root path and no scheme",
3333
apiTokenIssuer: "https://issuer.fga.example/",
34-
expectedBaseUrl: "https://issuer.fga.example",
34+
expectedBaseUrl: "https://issuer.fga.example:443",
3535
expectedPath: `/${DEFAULT_TOKEN_ENDPOINT_PATH}`,
3636
},
3737
{
3838
description: "should preserve custom token endpoint path when provided",
3939
apiTokenIssuer: "https://issuer.fga.example/some_endpoint",
40-
expectedBaseUrl: "https://issuer.fga.example",
40+
expectedBaseUrl: "https://issuer.fga.example:443",
4141
expectedPath: "/some_endpoint",
4242
},
4343
{
4444
description: "should preserve custom token endpoint path with nested path when provided",
4545
apiTokenIssuer: "https://issuer.fga.example/api/v1/oauth/token",
46-
expectedBaseUrl: "https://issuer.fga.example",
46+
expectedBaseUrl: "https://issuer.fga.example:443",
4747
expectedPath: "/api/v1/oauth/token",
4848
},
4949
{
5050
description: "should add https:// prefix when apiTokenIssuer has no scheme",
5151
apiTokenIssuer: "issuer.fga.example/some_endpoint",
52-
expectedBaseUrl: "https://issuer.fga.example",
52+
expectedBaseUrl: "https://issuer.fga.example:443",
5353
expectedPath: "/some_endpoint",
5454
},
5555
{
5656
description: "should preserve http:// scheme when provided",
5757
apiTokenIssuer: "http://issuer.fga.example/some_endpoint",
58-
expectedBaseUrl: "http://issuer.fga.example",
58+
expectedBaseUrl: "http://issuer.fga.example:80",
5959
expectedPath: "/some_endpoint",
6060
},
6161
{
6262
description: "should use default path when apiTokenIssuer has https:// scheme but no path",
6363
apiTokenIssuer: "https://issuer.fga.example",
64-
expectedBaseUrl: "https://issuer.fga.example",
64+
expectedBaseUrl: "https://issuer.fga.example:443",
6565
expectedPath: `/${DEFAULT_TOKEN_ENDPOINT_PATH}`,
6666
},
6767
{
6868
description: "should preserve custom path with query parameters",
6969
apiTokenIssuer: "https://issuer.fga.example/some_endpoint?param=value",
70-
expectedBaseUrl: "https://issuer.fga.example",
70+
expectedBaseUrl: "https://issuer.fga.example:443",
7171
expectedPath: "/some_endpoint",
7272
queryParams: { param: "value" },
7373
},
@@ -80,19 +80,19 @@ describe("Credentials", () => {
8080
{
8181
description: "should use default path when path has multiple trailing slashes",
8282
apiTokenIssuer: "https://issuer.fga.example///",
83-
expectedBaseUrl: "https://issuer.fga.example",
83+
expectedBaseUrl: "https://issuer.fga.example:443",
8484
expectedPath: `/${DEFAULT_TOKEN_ENDPOINT_PATH}`,
8585
},
8686
{
8787
description: "should use default path when path only consists of slashes",
8888
apiTokenIssuer: "https://issuer.fga.example//",
89-
expectedBaseUrl: "https://issuer.fga.example",
89+
expectedBaseUrl: "https://issuer.fga.example:443",
9090
expectedPath: `/${DEFAULT_TOKEN_ENDPOINT_PATH}`,
9191
},
9292
{
9393
description: "should preserve custom path with consecutive/trailing slashes",
9494
apiTokenIssuer: "https://issuer.fga.example/oauth//token///",
95-
expectedBaseUrl: "https://issuer.fga.example",
95+
expectedBaseUrl: "https://issuer.fga.example:443",
9696
expectedPath: "/oauth//token///",
9797
},
9898
])("$description", async ({ apiTokenIssuer, expectedBaseUrl, expectedPath, queryParams }) => {
@@ -163,19 +163,19 @@ describe("Credentials", () => {
163163
{
164164
description: "HTTPS scheme",
165165
apiTokenIssuer: "https://issuer.fga.example/some_endpoint",
166-
expectedBaseUrl: "https://issuer.fga.example",
166+
expectedBaseUrl: "https://issuer.fga.example:443",
167167
expectedAudience: "https://issuer.fga.example/some_endpoint/",
168168
},
169169
{
170170
description: "HTTP scheme",
171171
apiTokenIssuer: "http://issuer.fga.example/some_endpoint",
172-
expectedBaseUrl: "http://issuer.fga.example",
172+
expectedBaseUrl: "http://issuer.fga.example:80",
173173
expectedAudience: "http://issuer.fga.example/some_endpoint/",
174174
},
175175
{
176176
description: "No scheme",
177177
apiTokenIssuer: "issuer.fga.example/some_endpoint",
178-
expectedBaseUrl: "https://issuer.fga.example",
178+
expectedBaseUrl: "https://issuer.fga.example:443",
179179
expectedAudience: "https://issuer.fga.example/some_endpoint/",
180180
}
181181
])("should normalize audience from apiTokenIssuer when using PrivateKeyJWT client credentials ($description)", async ({ apiTokenIssuer, expectedBaseUrl, expectedAudience }) => {
@@ -211,4 +211,4 @@ describe("Credentials", () => {
211211
expect(scope.isDone()).toBe(true);
212212
});
213213
});
214-
});
214+
});

0 commit comments

Comments
 (0)