Skip to content

Commit 0bb3de1

Browse files
committed
fix(site): fix OrgsSortedAlphabetically test
1 parent a272843 commit 0bb3de1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

site/src/modules/management/OrganizationSidebarView.stories.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,13 @@ export const OrgsSortedAlphabetically: Story = {
256256
// filter out Create btn
257257
const filteredElems = orgElements.slice(0, 3);
258258

259-
const orgNames = filteredElems.map(
260-
// handling fuzzy matching
261-
(el) => el.textContent?.replace(/^[A-Z]/, "").trim() || "",
262-
);
259+
// Query the .truncate span to get only the organization name.
260+
// This avoids including the avatar content, which renders as the first
261+
// uppercase letter of the org name when the icon fails to load.
262+
const orgNames = filteredElems.map((el) => {
263+
const nameSpan = el.querySelector(".truncate");
264+
return nameSpan?.textContent?.trim() || "";
265+
});
263266

264267
// active name first
265268
expect(orgNames).toEqual(["Omega org", "alpha Org", "Zeta Org"]);

0 commit comments

Comments
 (0)