generated from nhcarrigan/template
chore: community feedback fixes and UI improvements (#102)
## Summary Addresses all community feedback tickets from the last deploy, plus several UI improvements made during the same session. ### Bug fixes & balance - **#97** — Fix auto-adventurer tier priority: sort by combat power instead of current cost so the highest-tier affordable unit is always purchased - **#98** — Add Dark Templar adventurer (80k CP) to bridge the Volcanic Depths progression wall; rewire upgrade and quest rewards accordingly - **#99** — Reorder and buff Shadow Assassin (55k CP, level 12) so Witch Coven feels rewarding rather than a regression - **#100** — Display effective Gold/s (all multipliers applied) in the resource bar - **#101** — Add Peasant tier 2 (10x, essence) and tier 3 (50x, crystals) upgrades for meaningful late-game scaling ### Other fixes - Sync game state to server before auto-boss challenges (matching manual challenge behaviour) - Refresh Discord avatar hash on every game load via bot token so stale CDN URLs are corrected automatically ### UI improvements - Replace Donate / Discord / Support / View Profile / Edit Profile buttons with a single avatar dropdown menu - Collapse all resources except Gold into a click-to-toggle dropdown; orange alert dot appears when a hidden resource is capped ## Closes Closes #97 Closes #98 Closes #99 Closes #100 Closes #101 Reviewed-on: #102 Co-authored-by: Hikari <hikari@nhcarrigan.com> Co-committed-by: Hikari <hikari@nhcarrigan.com>
This commit was merged in pull request #102.
This commit is contained in:
@@ -104,4 +104,53 @@ describe("discord service", () => {
|
||||
await expect(exchangeCode("some_code")).rejects.toBe("raw string error");
|
||||
});
|
||||
});
|
||||
|
||||
describe("fetchDiscordUserById", () => {
|
||||
it("returns null when DISCORD_BOT_TOKEN is missing", async () => {
|
||||
delete process.env["DISCORD_BOT_TOKEN"];
|
||||
const { fetchDiscordUserById } = await import("../../src/services/discord.js");
|
||||
const result = await fetchDiscordUserById("123456");
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it("returns null when DISCORD_BOT_TOKEN is empty", async () => {
|
||||
process.env["DISCORD_BOT_TOKEN"] = "";
|
||||
const { fetchDiscordUserById } = await import("../../src/services/discord.js");
|
||||
const result = await fetchDiscordUserById("123456");
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it("returns null when response is not ok", async () => {
|
||||
process.env["DISCORD_BOT_TOKEN"] = "bot_token";
|
||||
mockFetch.mockResolvedValueOnce({ ok: false, statusText: "Not Found" });
|
||||
const { fetchDiscordUserById } = await import("../../src/services/discord.js");
|
||||
const result = await fetchDiscordUserById("123456");
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it("returns null when fetch throws", async () => {
|
||||
process.env["DISCORD_BOT_TOKEN"] = "bot_token";
|
||||
mockFetch.mockRejectedValueOnce(new Error("network error"));
|
||||
const { fetchDiscordUserById } = await import("../../src/services/discord.js");
|
||||
const result = await fetchDiscordUserById("123456");
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it("returns null when fetch throws a non-Error value", async () => {
|
||||
process.env["DISCORD_BOT_TOKEN"] = "bot_token";
|
||||
mockFetch.mockRejectedValueOnce("raw string error");
|
||||
const { fetchDiscordUserById } = await import("../../src/services/discord.js");
|
||||
const result = await fetchDiscordUserById("123456");
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it("returns the user on success", async () => {
|
||||
process.env["DISCORD_BOT_TOKEN"] = "bot_token";
|
||||
const user = { id: "123456", username: "testuser", discriminator: "0", avatar: "abc123" };
|
||||
mockFetch.mockResolvedValueOnce({ ok: true, json: () => Promise.resolve(user) });
|
||||
const { fetchDiscordUserById } = await import("../../src/services/discord.js");
|
||||
const result = await fetchDiscordUserById("123456");
|
||||
expect(result).toMatchObject({ id: "123456", avatar: "abc123" });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user