mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-22 04:55:53 +02:00
* start migrating Utils.apiFetch to api class
* move dailyranking to api
* use api in title-ui-handler
* remove: Utils.apiFetch
* migrate `updateSystemSavedata` to api
* migrate clear session savedata to api
* migrate updateAllSavedata to api
* migrate `updateSessionSavedata` to api
* rename `api` to `pokerogue-api`
* migrate unlink discord to pokerogue-api
* migrate unlink google to pokerogue-api
* update pokerogue-api login
* migrate register account to pokerogue-api
* remove Utils.apiPost
* reset overrides.ts
* chore: cleanup
* fix env.development
* fix circular dependencies with api
* fix gamedata verify missing await
* fix daily api calls in daily-run-scorebard
* fix discord-link request body being empty
there was a double `toUrlSearchParams()` call involved
* add pokerogue-api test coverge
* add test-utils `getApiBaseUrl()` method
* add pokerogue-admin-api test coverage
* add pokerogue-account-api test coverage
* add pokerogue-daily-api test coverage
* add pokerogue-savedata-api test coverage
* fix some test describes
* add pokerogue-session-savedata-api test coverage
* add pokerogue-system-savedata-api test coverage
* fix tests
* fix tryExportData
thanks @MokaStitcher
* chore: fix menu-ui-handlers.ts
* fix admin-ui-handler (types)
* extend test-coverage for admin-api
* remove outdated code
* skip some clowning-around-encounter tests if events are active
this is not a permanent solution
* Update src/system/game-data.ts
Co-authored-by: PigeonBar <56974298+PigeonBar@users.noreply.github.com>
* Revert "skip some clowning-around-encounter tests if events are active"
This reverts commit a97dafe8b2
.
* mark `localServerUrl` and `apiUrl` as deprecated
in `utils.ts`
---------
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: PigeonBar <56974298+PigeonBar@users.noreply.github.com>
102 lines
3.1 KiB
TypeScript
102 lines
3.1 KiB
TypeScript
import { Biome } from "#app/enums/biome";
|
|
import { Moves } from "#app/enums/moves";
|
|
import { MapModifier } from "#app/modifier/modifier";
|
|
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
|
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
|
|
import { Species } from "#enums/species";
|
|
import { Mode } from "#app/ui/ui";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
import GameManager from "#app/test/utils/gameManager";
|
|
|
|
//const TIMEOUT = 20 * 1000;
|
|
|
|
describe("Daily Mode", () => {
|
|
let phaserGame: Phaser.Game;
|
|
let game: GameManager;
|
|
|
|
beforeAll(() => {
|
|
phaserGame = new Phaser.Game({
|
|
type: Phaser.HEADLESS,
|
|
});
|
|
});
|
|
|
|
beforeEach(() => {
|
|
game = new GameManager(phaserGame);
|
|
vi.spyOn(pokerogueApi.daily, "getSeed").mockResolvedValue("test-seed");
|
|
});
|
|
|
|
afterEach(() => {
|
|
game.phaseInterceptor.restoreOg();
|
|
});
|
|
|
|
it("should initialize properly", async () => {
|
|
await game.dailyMode.runToSummon();
|
|
|
|
const party = game.scene.getPlayerParty();
|
|
expect(party).toHaveLength(3);
|
|
party.forEach((pkm) => {
|
|
expect(pkm.level).toBe(20);
|
|
expect(pkm.moveset.length).toBeGreaterThan(0);
|
|
});
|
|
expect(game.scene.getModifiers(MapModifier).length).toBeGreaterThan(0);
|
|
});
|
|
});
|
|
|
|
describe("Shop modifications", async () => {
|
|
let phaserGame: Phaser.Game;
|
|
let game: GameManager;
|
|
|
|
beforeAll(() => {
|
|
phaserGame = new Phaser.Game({
|
|
type: Phaser.HEADLESS,
|
|
});
|
|
});
|
|
beforeEach(() => {
|
|
game = new GameManager(phaserGame);
|
|
|
|
game.override
|
|
.startingWave(9)
|
|
.startingBiome(Biome.ICE_CAVE)
|
|
.battleType("single")
|
|
.startingLevel(100) // Avoid levelling up
|
|
.disableTrainerWaves()
|
|
.moveset([ Moves.SPLASH ])
|
|
.enemyMoveset(Moves.SPLASH);
|
|
game.modifiers
|
|
.addCheck("EVIOLITE")
|
|
.addCheck("MINI_BLACK_HOLE");
|
|
vi.spyOn(pokerogueApi.daily, "getSeed").mockResolvedValue("test-seed");
|
|
});
|
|
|
|
afterEach(() => {
|
|
game.phaseInterceptor.restoreOg();
|
|
game.modifiers.clearChecks();
|
|
});
|
|
|
|
it("should not have Eviolite and Mini Black Hole available in Classic if not unlocked", async () => {
|
|
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
|
game.move.select(Moves.SPLASH);
|
|
await game.doKillOpponents();
|
|
await game.phaseInterceptor.to("BattleEndPhase");
|
|
game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => {
|
|
expect(game.scene.ui.getHandler()).toBeInstanceOf(ModifierSelectUiHandler);
|
|
game.modifiers
|
|
.testCheck("EVIOLITE", false)
|
|
.testCheck("MINI_BLACK_HOLE", false);
|
|
});
|
|
});
|
|
|
|
it("should have Eviolite and Mini Black Hole available in Daily", async () => {
|
|
await game.dailyMode.startBattle();
|
|
game.move.select(Moves.SPLASH);
|
|
await game.doKillOpponents();
|
|
await game.phaseInterceptor.to("BattleEndPhase");
|
|
game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => {
|
|
expect(game.scene.ui.getHandler()).toBeInstanceOf(ModifierSelectUiHandler);
|
|
game.modifiers
|
|
.testCheck("EVIOLITE", true)
|
|
.testCheck("MINI_BLACK_HOLE", true);
|
|
});
|
|
});
|
|
});
|