diff --git a/spec/unit/credential_provider/ClientCredentialProvider.spec.ts b/spec/unit/credential_provider/ClientCredentialProvider.spec.ts new file mode 100644 index 000000000..ad2a7e154 --- /dev/null +++ b/spec/unit/credential_provider/ClientCredentialProvider.spec.ts @@ -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 + ); + }); +}); diff --git a/spec/unit/credential_provider/NoAuthCredentialProvider.spec.ts b/spec/unit/credential_provider/NoAuthCredentialProvider.spec.ts new file mode 100644 index 000000000..b86568361 --- /dev/null +++ b/spec/unit/credential_provider/NoAuthCredentialProvider.spec.ts @@ -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 + ); + }); +}); diff --git a/spec/unit/credential_provider/OrgsCredentialProvider.spec.ts b/spec/unit/credential_provider/OrgsCredentialProvider.spec.ts new file mode 100644 index 000000000..8fbed0d09 --- /dev/null +++ b/spec/unit/credential_provider/OrgsCredentialProvider.spec.ts @@ -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 + ); + }); +});