Merge branch 'feature/recipe-paper-ingredient-names'
@@ -10,8 +10,11 @@ import
10
10
hashAlchemySteps,
11
11
resolvedAlchemyPotions,
12
12
unstablePotionFromSteps,
13
potionItemInstance
13
potionItemInstance,
14
recipePaperBody,
15
formatAlchemyStep
14
16
} from "../../shared/alchemy/recipes.js";
17
import { alchemyPotionDefinition } from "../../shared/definitions/alchemy.js";
15
18
import { emptyEquipment, emptySlots, insertStack } from "../../shared/items/inventory.js";
16
19
import { createEmptyChunkData, encodeChunkBlob } from "../src/world/chunkData.js";
17
20
import { Component } from "../src/ecs/components.js";
@@ -47,6 +50,24 @@ function countItem (slots, itemId)
47
50
.reduce((sum, slot) => sum + (slot.quantity | 0), 0);
48
51
}
49
52
53
test("recipe paper body resolves ingredient keys to display names", () =>
54
{
55
const potion = alchemyPotionDefinition("tanningBrew");
56
assert.ok(potion);
57
const body = recipePaperBody(potion);
58
assert.match(body, /2× Oak bark/);
59
assert.match(body, /1× Rock salt/);
60
assert.match(body, /1× Bottle of Animal Fat \(full bottle\)/);
61
assert.doesNotMatch(body, /oak-bark/);
62
assert.doesNotMatch(body, /rock-salt/);
63
assert.match(body, /- insert Oak bark/);
64
assert.match(body, /- insert Rock salt/);
65
assert.equal(
66
formatAlchemyStep({ kind: AlchemyStepKind.insert, itemKey: "oak-bark" }),
67
"insert Oak bark"
68
);
69
});
70
50
71
test("lesser health tonic ratios and steps evaluate to a success batch", () =>
51
72
{
52
73
const potion = resolvedAlchemyPotions().find((entry) => entry.potionKey === "lesserHealthTonic");
@@ -10,8 +10,11 @@ import10
hashAlchemySteps,10
hashAlchemySteps,11
resolvedAlchemyPotions,11
resolvedAlchemyPotions,12
unstablePotionFromSteps,12
unstablePotionFromSteps,13
potionItemInstance13
potionItemInstance,14
recipePaperBody,15
formatAlchemyStep14
} from "../../shared/alchemy/recipes.js";16
} from "../../shared/alchemy/recipes.js";17
import { alchemyPotionDefinition } from "../../shared/definitions/alchemy.js";15
import { emptyEquipment, emptySlots, insertStack } from "../../shared/items/inventory.js";18
import { emptyEquipment, emptySlots, insertStack } from "../../shared/items/inventory.js";16
import { createEmptyChunkData, encodeChunkBlob } from "../src/world/chunkData.js";19
import { createEmptyChunkData, encodeChunkBlob } from "../src/world/chunkData.js";17
import { Component } from "../src/ecs/components.js";20
import { Component } from "../src/ecs/components.js";@@ -47,6 +50,24 @@ function countItem (slots, itemId)47
.reduce((sum, slot) => sum + (slot.quantity | 0), 0);50
.reduce((sum, slot) => sum + (slot.quantity | 0), 0);48
}51
}49
52
53
test("recipe paper body resolves ingredient keys to display names", () =>54
{55
const potion = alchemyPotionDefinition("tanningBrew");56
assert.ok(potion);57
const body = recipePaperBody(potion);58
assert.match(body, /2× Oak bark/);59
assert.match(body, /1× Rock salt/);60
assert.match(body, /1× Bottle of Animal Fat \(full bottle\)/);61
assert.doesNotMatch(body, /oak-bark/);62
assert.doesNotMatch(body, /rock-salt/);63
assert.match(body, /- insert Oak bark/);64
assert.match(body, /- insert Rock salt/);65
assert.equal(66
formatAlchemyStep({ kind: AlchemyStepKind.insert, itemKey: "oak-bark" }),67
"insert Oak bark"68
);69
});70
50
test("lesser health tonic ratios and steps evaluate to a success batch", () =>71
test("lesser health tonic ratios and steps evaluate to a success batch", () =>51
{72
{52
const potion = resolvedAlchemyPotions().find((entry) => entry.potionKey === "lesserHealthTonic");73
const potion = resolvedAlchemyPotions().find((entry) => entry.potionKey === "lesserHealthTonic");