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
4 changes: 2 additions & 2 deletions src/libs/Avatars/PresetAvatarCatalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ function getLetterAvatar(name?: string): React.FC<SvgProps> | null {

const PRESET_AVATAR_CATALOG_ORDERED = buildOrderedAvatars();

const getAvatarLocal = (id: PresetAvatarID) => PRESET_AVATAR_CATALOG[id].local;
const getAvatarURL = (id: PresetAvatarID) => PRESET_AVATAR_CATALOG[id].url;
const getAvatarLocal = (id: PresetAvatarID) => PRESET_AVATAR_CATALOG[id]?.local;
const getAvatarURL = (id: PresetAvatarID) => PRESET_AVATAR_CATALOG[id]?.url;

/**
* Type guard to check if a value is a valid PresetAvatarID
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/libs/Avatars/PresetAvatarCatalogTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ describe('PresetAvatarCatalog', () => {

it('throws or returns undefined for an unknown ID', () => {
// @ts-expect-error - This is a test for an unknown ID
expect(() => getAvatarLocal('not-a-real-id')).toThrow();
expect(getAvatarLocal('not-a-real-id')).toBeUndefined();
// @ts-expect-error - This is a test for an unknown ID
expect(getAvatarURL('not-a-real-id')).toBeUndefined();
});

it('ALL contains both default and seasonal IDs', () => {
Expand Down
Loading