forked from phenom/healer-man
Update Healer Man server
This commit is contained in:
1 parent
9c5fb4c614
commit
bd073fb00f
113 files changed
+4902
-273
No files matched your search
@@ -2,7 +2,8 @@ import { describe, expect, it, vi } from "vitest";
|
||||
import { createDefaultAppearance } from "./characterCatalog";
|
||||
import type { CharacterProfile, PlayerSession } from "./types";
|
||||
import type { OnlineGroup } from "./onlineGroupTypes";
|
||||
import { dungeonById } from "../game/dungeonCatalog";
|
||||
import { dungeonById, dungeonsByCategory, randomRegularDungeon } from "../game/dungeonCatalog";
|
||||
import { DEFAULT_DUNGEON_QUEUE_POLICY } from "../game/dungeonQueuePolicy";
|
||||
import { dungeonContentPackId } from "../game/dungeonContentSource";
|
||||
import { queueRandomDungeon, type RandomDungeonQueueOptions } from "./randomDungeonQueue";
|
||||
|
||||
@@ -37,6 +38,7 @@ describe("random dungeon queue", () => {
|
||||
const options = queueOptions();
|
||||
const result = await queueRandomDungeon(options, {
|
||||
random: () => 0,
|
||||
loadPolicy: async () => DEFAULT_DUNGEON_QUEUE_POLICY,
|
||||
contentIsUsable: () => installed,
|
||||
installPack,
|
||||
installDungeonRuntime,
|
||||
@@ -58,6 +60,7 @@ describe("random dungeon queue", () => {
|
||||
const options = queueOptions({ mode: "bite-sized" });
|
||||
await expect(queueRandomDungeon(options, {
|
||||
random: () => 0,
|
||||
loadPolicy: async () => DEFAULT_DUNGEON_QUEUE_POLICY,
|
||||
contentIsUsable: () => true,
|
||||
installPack,
|
||||
installDungeonRuntime: vi.fn(async () => undefined),
|
||||
@@ -66,10 +69,35 @@ describe("random dungeon queue", () => {
|
||||
expect(installPack).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("skips a disabled full dungeon and rejects a queue with no enabled Bite-Sized locations", async () => {
|
||||
const first = randomRegularDungeon(undefined, () => 0)!;
|
||||
const options = queueOptions();
|
||||
await expect(queueRandomDungeon(options, {
|
||||
random: () => 0,
|
||||
loadPolicy: async () => ({ schemaVersion: 1, disabled: { regular: [first.id], biteSized: [], randomizedBiteSized: [] } }),
|
||||
contentIsUsable: () => true,
|
||||
installPack: vi.fn(),
|
||||
installDungeonRuntime: vi.fn(),
|
||||
})).resolves.toMatchObject({ status: "entered" });
|
||||
expect(options.enterDungeon).not.toHaveBeenCalledWith(first.id, expect.anything(), expect.anything());
|
||||
|
||||
const biteOptions = queueOptions({ mode: "bite-sized" });
|
||||
await expect(queueRandomDungeon(biteOptions, {
|
||||
random: () => 0,
|
||||
loadPolicy: async () => ({ schemaVersion: 1, disabled: { regular: [],
|
||||
biteSized: dungeonsByCategory("bite-sized").map((dungeon) => dungeon.id), randomizedBiteSized: [] } }),
|
||||
contentIsUsable: () => true,
|
||||
installPack: vi.fn(),
|
||||
installDungeonRuntime: vi.fn(),
|
||||
})).resolves.toMatchObject({ status: "error", message: expect.stringMatching(/no dungeon/i) });
|
||||
expect(biteOptions.enterDungeon).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not enter when the downloaded pack cannot be verified", async () => {
|
||||
const options = queueOptions();
|
||||
const result = await queueRandomDungeon(options, {
|
||||
random: () => 0,
|
||||
loadPolicy: async () => DEFAULT_DUNGEON_QUEUE_POLICY,
|
||||
contentIsUsable: () => false,
|
||||
installPack: vi.fn(async () => undefined),
|
||||
installDungeonRuntime: vi.fn(async () => undefined),
|
||||
@@ -83,6 +111,7 @@ describe("random dungeon queue", () => {
|
||||
const options = queueOptions({ session: accountSession, group });
|
||||
const result = await queueRandomDungeon(options, {
|
||||
random: () => 0,
|
||||
loadPolicy: async () => DEFAULT_DUNGEON_QUEUE_POLICY,
|
||||
contentIsUsable: () => installed,
|
||||
installPack: vi.fn(async () => { installed = true; }),
|
||||
installDungeonRuntime: vi.fn(async () => undefined),
|
||||
@@ -100,6 +129,7 @@ describe("random dungeon queue", () => {
|
||||
const installPack = vi.fn(async () => undefined);
|
||||
await expect(queueRandomDungeon(options, {
|
||||
random: () => 0,
|
||||
loadPolicy: async () => DEFAULT_DUNGEON_QUEUE_POLICY,
|
||||
contentIsUsable: () => false,
|
||||
installPack,
|
||||
installDungeonRuntime: vi.fn(async () => undefined),
|
||||
|
||||
Reference in new issue
Block a user