Skip to content

Commit 83c9847

Browse files
committed
fix(site): fix OrgsSortedAlphabetically test
1 parent a272843 commit 83c9847

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
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"]);

site/src/testHelpers/entities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const MockOrganization: TypesGen.Organization = {
1717
name: "my-organization",
1818
display_name: "My Organization",
1919
description: "An organization that gets used for stuff.",
20-
icon: "/emojis/1f957.png",
20+
icon: "/emojis/1f60e.png",
2121
created_at: "",
2222
updated_at: "",
2323
is_default: false,

0 commit comments

Comments
 (0)