Skip to content

Commit

Permalink
chore: add credential provider tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwarishubham635 committed Dec 5, 2024
1 parent e01b796 commit 4968d9f
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spec/unit/credential_provider/ClientCredentialProvider.spec.ts
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 spec/unit/credential_provider/NoAuthCredentialProvider.spec.ts
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 spec/unit/credential_provider/OrgsCredentialProvider.spec.ts
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
);
});
});

0 comments on commit 4968d9f

Please sign in to comment.