-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add credential provider tests
- Loading branch information
1 parent
e01b796
commit 4968d9f
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
spec/unit/credential_provider/ClientCredentialProvider.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import ClientCredentialProvider from "../../../src/credential_provider/ClientCredentialProvider"; | ||
import TokenAuthStrategy from "../../../src/auth_strategy/TokenAuthStrategy"; | ||
|
||
describe("ClientCredentialProvider Constructor", () => { | ||
const clientCredentialProvider = | ||
new ClientCredentialProvider.ClientCredentialProviderBuilder() | ||
.setClientId("clientId") | ||
.setClientSecret("clientSecret") | ||
.build(); | ||
|
||
it("Should have client-credentials as its authType", () => { | ||
expect(clientCredentialProvider.getAuthType()).toEqual( | ||
"client-credentials" | ||
); | ||
}); | ||
|
||
it("Should return NoAuthStrategy as its auth strategy", () => { | ||
expect(clientCredentialProvider.toAuthStrategy()).toBeInstanceOf( | ||
TokenAuthStrategy | ||
); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
spec/unit/credential_provider/NoAuthCredentialProvider.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import NoAuthCredentialProvider from "../../../src/credential_provider/NoAuthCredentialProvider"; | ||
import NoAuthStrategy from "../../../src/auth_strategy/NoAuthStrategy"; | ||
|
||
describe("NoAuthCredentialProvider Constructor", () => { | ||
const noAuthCredentialProvider = | ||
new NoAuthCredentialProvider.NoAuthCredentialProvider(); | ||
|
||
it("Should have client-credentials as its authType", () => { | ||
expect(noAuthCredentialProvider.getAuthType()).toEqual("noauth"); | ||
}); | ||
|
||
it("Should return NoAuthStrategy as its auth strategy", () => { | ||
expect(noAuthCredentialProvider.toAuthStrategy()).toBeInstanceOf( | ||
NoAuthStrategy | ||
); | ||
}); | ||
}); |
22 changes: 22 additions & 0 deletions
22
spec/unit/credential_provider/OrgsCredentialProvider.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import OrgsCredentialProvider from "../../../src/credential_provider/OrgsCredentialProvider"; | ||
import TokenAuthStrategy from "../../../src/auth_strategy/TokenAuthStrategy"; | ||
|
||
describe("OrgsCredentialProvider Constructor", () => { | ||
const orgsCredentialProvider = | ||
new OrgsCredentialProvider.OrgsCredentialProviderBuilder() | ||
.setClientId("clientId") | ||
.setClientSecret("clientSecret") | ||
.build(); | ||
|
||
it("Should have client-credentials as its authType", () => { | ||
expect(orgsCredentialProvider.getAuthType()).toEqual( | ||
"client-credentials" | ||
); | ||
}); | ||
|
||
it("Should return NoAuthStrategy as its auth strategy", () => { | ||
expect(orgsCredentialProvider.toAuthStrategy()).toBeInstanceOf( | ||
TokenAuthStrategy | ||
); | ||
}); | ||
}); |