mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2025-12-15 20:45:55 +00:00
Feat: uncut gems fixed
This commit is contained in:
@@ -1,28 +1,42 @@
|
||||
// itemTextToSections.test.ts
|
||||
import { __testExports } from "@/parser/Parser";
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { beforeEach, describe, expect, test } from "vitest";
|
||||
import { setupTests } from "../vitest.setup";
|
||||
import {
|
||||
MagicItem,
|
||||
NormalItem,
|
||||
RareItem,
|
||||
RareWithImplicit,
|
||||
UniqueItem,
|
||||
} from "./items";
|
||||
import { loadForLang } from "@/assets/data";
|
||||
|
||||
describe("itemTextToSections", () => {
|
||||
setupTests();
|
||||
beforeEach(async () => {
|
||||
setupTests();
|
||||
await loadForLang("en");
|
||||
});
|
||||
test("empty string should not throw", () => {
|
||||
expect(() => __testExports.itemTextToSections("")).not.toThrow();
|
||||
});
|
||||
test("standard item", () => {
|
||||
const sections = __testExports.itemTextToSections(
|
||||
`Item Class: Staves
|
||||
Rarity: Magic
|
||||
Chiming Staff of Havoc
|
||||
--------
|
||||
Requirements:
|
||||
Level: 58
|
||||
Int: 133 (unmet)
|
||||
--------
|
||||
Item Level: 62
|
||||
--------
|
||||
+5 to Level of all Chaos Spell Skills
|
||||
`,
|
||||
);
|
||||
expect(sections.length).toBe(4);
|
||||
const sections = __testExports.itemTextToSections(RareItem.rawText);
|
||||
expect(sections.length).toBe(RareItem.sectionCount);
|
||||
});
|
||||
test("magic item", () => {
|
||||
const sections = __testExports.itemTextToSections(MagicItem.rawText);
|
||||
expect(sections.length).toBe(MagicItem.sectionCount);
|
||||
});
|
||||
test("normal item", () => {
|
||||
const sections = __testExports.itemTextToSections(NormalItem.rawText);
|
||||
expect(sections.length).toBe(NormalItem.sectionCount);
|
||||
});
|
||||
test("unique item", () => {
|
||||
const sections = __testExports.itemTextToSections(UniqueItem.rawText);
|
||||
expect(sections.length).toBe(UniqueItem.sectionCount);
|
||||
});
|
||||
test("rare item with implicit", () => {
|
||||
const sections = __testExports.itemTextToSections(RareWithImplicit.rawText);
|
||||
expect(sections.length).toBe(RareWithImplicit.sectionCount);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user