Skip to content
Merged
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
26 changes: 26 additions & 0 deletions lib/oss-roster.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { describe, expect, it, vi } from "vitest";
import { ossRoster } from "./oss-roster";

vi.mock("@/lib/members", () => ({
loadRoster: async () => [{
name: "Nishtha Agarwal",
github: "nishtha-agarwal-211",
usn: "2102508773",
hasPhoto: true,
councilPosition: "Membership Lead",
}],
normalizeGithub: (value: string) => value,
}));

describe("public open-source roster", () => {
it("uses a public avatar for a member with a private photo", async () => {
const roster = await ossRoster("second-year");
const nishtha = roster.find(
(member) => member.github === "nishtha-agarwal-211",
);

expect(nishtha?.avatar).toBe(
"https://github.com/nishtha-agarwal-211.png",
);
});
});
4 changes: 1 addition & 3 deletions lib/oss-roster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ async function secondYear(): Promise<Contributor[]> {
name: member.name,
github: member.github,
role: member.councilPosition ?? "Member",
avatar: member.hasPhoto
? `/api/members/${member.usn}/avatar`
: `https://github.com/${member.github}.png`,
avatar: `https://github.com/${member.github}.png`,
year: "second-year",
});
}
Expand Down
Loading