Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If an api token is not passed in the constructor, check the env variable #548

Merged
merged 6 commits into from
Nov 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Shubham Sharma <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
elena-kolevska and shubham1172 authored Nov 6, 2023
commit 41e7b85521cbe24dd2c150b6d0fe987a0c9b7d72
4 changes: 2 additions & 2 deletions test/unit/utils/Client.util.test.ts
Original file line number Diff line number Diff line change
@@ -368,15 +368,15 @@ describe("Client.util", () => {
expect(options.daprApiToken).toEqual("token");
});

it("returns correct Dapr Client Options when token provided in anv variable", () => {
it("returns correct Dapr Client Options when token provided in env variable", () => {
const oldToken = process.env.DAPR_API_TOKEN
process.env.DAPR_API_TOKEN = "envtoken";
const options = getClientOptions(undefined, CommunicationProtocolEnum.HTTP, undefined);
expect(options.daprApiToken).toEqual("envtoken");
process.env.DAPR_API_TOKEN = oldToken;
});

it("returns correct Dapr Client Options when token provided both in constructor and in anv variable", () => {
it("returns correct Dapr Client Options when token provided both in constructor and in env variable", () => {
process.env.DAPR_API_TOKEN = "envtoken";

const inOptions: Partial<DaprClientOptions> = {