Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export class DurableTaskAzureManagedConnectionString {
if (!value || value === "") {
return undefined;
}
return value.split(",");
return value
.split(",")
.map((t) => t.trim())
.filter((t) => t !== "");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,36 @@ describe("DurableTaskAzureManagedConnectionString", () => {

expect(tenants).toEqual(["tenant1", "tenant2"]);
});

it("should trim whitespace from each tenant value", () => {
const connectionStringWithSpaces =
VALID_CONNECTION_STRING + ";AdditionallyAllowedTenants=tenant1, tenant2 , tenant3";

const connectionString = new DurableTaskAzureManagedConnectionString(connectionStringWithSpaces);
const tenants = connectionString.getAdditionallyAllowedTenants();

expect(tenants).toEqual(["tenant1", "tenant2", "tenant3"]);
});

it("should filter out empty entries from trailing commas", () => {
const connectionStringWithTrailingComma =
VALID_CONNECTION_STRING + ";AdditionallyAllowedTenants=tenant1,tenant2,";

const connectionString = new DurableTaskAzureManagedConnectionString(connectionStringWithTrailingComma);
const tenants = connectionString.getAdditionallyAllowedTenants();

expect(tenants).toEqual(["tenant1", "tenant2"]);
});

it("should handle wildcard tenant value", () => {
const connectionStringWithWildcard =
VALID_CONNECTION_STRING + ";AdditionallyAllowedTenants=*";

const connectionString = new DurableTaskAzureManagedConnectionString(connectionStringWithWildcard);
const tenants = connectionString.getAdditionallyAllowedTenants();

expect(tenants).toEqual(["*"]);
});
});

describe("getClientId", () => {
Expand Down
Loading