Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TwoAbove committed Aug 31, 2024
1 parent 677849e commit e6de8ed
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { describe, it, expect } from "vitest";
import { ChestRandomProvider } from "./ChestRandom";
import { ChestRandomInfoProvider } from "./ChestRandom";
import { loadRandom, getUnlockedSpells } from "../../../../testHelpers";
import { SpellInfoProvider } from "./Spell";

const spellInfoProvider = new SpellInfoProvider({} as any);

describe("ChestRandomProvider", () => {
describe("ChestRandomInfoProvider", () => {
const tests = [
{
seed: 1674055821,
Expand Down Expand Up @@ -64,7 +64,7 @@ describe("ChestRandomProvider", () => {
tests.forEach((t, i) => {
it(`Should generate correct output #${i}`, async () => {
const randoms = await loadRandom();
const ap = new ChestRandomProvider(randoms, getUnlockedSpells(), spellInfoProvider);
const ap = new ChestRandomInfoProvider(randoms, getUnlockedSpells(), spellInfoProvider);
randoms.SetWorldSeed(t.seed);
const res = ap.provide(t.params.x, t.params.y);
expect(res).toEqual(t.ans);
Expand All @@ -74,7 +74,7 @@ describe("ChestRandomProvider", () => {

it("Should correctly handle PW >27", async () => {
const randoms = await loadRandom();
const ap = new ChestRandomProvider(randoms, getUnlockedSpells(), spellInfoProvider);
const ap = new ChestRandomInfoProvider(randoms, getUnlockedSpells(), spellInfoProvider);
randoms.SetWorldSeed(1151);
// assuming regular rounding
const x1 = 1003442;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, expect } from "vitest";
import { FungalInfoProvider } from "./";
import { FungalShiftInfoProvider } from "./";
import { loadRandom } from "../../../../../testHelpers";

describe("FungalInfoProvider", () => {
describe("FungalShiftInfoProvider", () => {
const tests = [
{
seed: 123,
Expand Down Expand Up @@ -347,7 +347,7 @@ describe("FungalInfoProvider", () => {
tests.forEach((t, i) => {
it(`Should generate correct output #${i}`, async () => {
const randoms = await loadRandom();
const ap = new FungalInfoProvider(randoms);
const ap = new FungalShiftInfoProvider(randoms);
await ap.ready();
randoms.SetWorldSeed(t.seed);
const res = ap.provide();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { describe, it, expect } from "vitest";
import { PacifistChestProvider } from "./PacifistChest";
import { PacifistChestInfoProvider } from "./PacifistChest";
import { loadRandom, getUnlockedSpells } from "../../../../testHelpers";
import { ChestRandomProvider } from "./ChestRandom";
import { ChestRandomInfoProvider } from "./ChestRandom";
import { SpellInfoProvider } from "./Spell";

const spellInfoProvider = new SpellInfoProvider({} as any);

describe("PacifistChestProvider", () => {
describe("PacifistChestInfoProvider", () => {
const tests = [
{
seed: 1674055821,
Expand Down Expand Up @@ -263,9 +263,9 @@ describe("PacifistChestProvider", () => {
tests.forEach((t, i) => {
it(`Should generate correct output #${i}`, async () => {
const randoms = await loadRandom();
const chestProvider = new ChestRandomProvider(randoms, getUnlockedSpells(), spellInfoProvider);
const chestProvider = new ChestRandomInfoProvider(randoms, getUnlockedSpells(), spellInfoProvider);
await chestProvider.ready();
const ap = new PacifistChestProvider(randoms, chestProvider);
const ap = new PacifistChestInfoProvider(randoms, chestProvider);
randoms.SetWorldSeed(t.seed);
const res = ap.provide(t.params.level, t.params.worldOffset, t.params.fallback, t.params.greed);
expect(res).toEqual(t.ans);
Expand Down

0 comments on commit e6de8ed

Please sign in to comment.