57 lines
5.4 KiB
JavaScript
57 lines
5.4 KiB
JavaScript
import {test} from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import {readFileSync} from 'node:fs';
|
|
const root=new URL('../',import.meta.url),read=p=>JSON.parse(readFileSync(new URL(p,root)));
|
|
test('stew consumes custom cooked Jerboa meat and contaminated spice; no mushroom',()=>{
|
|
const r=read('DuneRealmsGUI/executablecrafting/recipes/jerboa_stew.yml'),inputs=Object.entries(r).filter(([k])=>/^input\d$/.test(k)).map(([,v])=>v);
|
|
assert.equal(inputs.length,5);assert.ok(inputs[0].includes('jerboa_cooked_meat'));assert.ok(inputs[3].includes('polluted_refined_spice'));assert.ok(inputs.includes('minecraft:bowl'));assert.ok(!inputs.some(v=>v.includes('mushroom')));
|
|
assert.equal(r.itemCheckers.checkExecutableItemID,true);assert.equal(r.itemCheckers.checkMaterial,true);
|
|
for(const item of [...inputs,r.result].filter(v=>v.includes('minecraft:custom_data'))) {
|
|
assert.match(item,/^minecraft:[a-z_]+\[minecraft:custom_data=/);
|
|
assert.ok(!item.includes('"minecraft:custom_name":"{'));
|
|
}
|
|
});
|
|
test('native food configuration uses the integer fields required by EI',()=>{
|
|
for(const id of ['jerboa_raw_meat','jerboa_cooked_meat','jerboa_stew']){
|
|
const item=read('DuneRealmsGUI/executableitems/arrakis/'+id+'.yml');assert.ok(Number.isInteger(item.foodFeatures.saturation));assert.ok(Number.isInteger(item.consumableFeatures.consumeSeconds));
|
|
}
|
|
});
|
|
test('cooking retains the custom item identity and Rare MK VI grade',()=>{
|
|
const r=read('DuneRealmsGUI/executablecrafting/recipes/jerboa_cooked_meat.yml');assert.equal(r.recipeType,'FURNACE');assert.ok(r.input1.includes('jerboa_raw_meat'));assert.ok(r.result.includes('jerboa_cooked_meat'));assert.ok(r.result.includes('"dunerealms:equipment_mark":"6"'));
|
|
});
|
|
|
|
test('a water bucket requires three genuine water vials and an empty bucket',()=>{
|
|
const r=read('DuneRealmsGUI/executablecrafting/recipes/jerboa_water_bucket.yml');
|
|
const inputs=Object.entries(r).filter(([key])=>/^input\d$/.test(key)).map(([,value])=>value);
|
|
assert.equal(r.typeOfCraftingTableRecipe,'SHAPELESS');assert.equal(inputs.length,4);
|
|
assert.equal(inputs.filter(value=>value.includes('"executableitems:ei-id":"jerboa_water_vial"')).length,3);
|
|
assert.equal(inputs.filter(value=>value==='minecraft:bucket').length,1);
|
|
assert.equal(r.itemCheckers.checkExecutableItemID,true);
|
|
assert.match(r.result,/^minecraft:water_bucket\[/);assert.ok(r.result.includes('"dunerealms:equipment_mark":"7"'));assert.ok(r.result.includes('"dunerealms:quality":"rare"'));
|
|
});
|
|
test('stew and memorial grades agree with the shared lore catalogue',()=>{
|
|
const p=read('JarvisConnector/src/main/resources/item-templates.json').templates;
|
|
for(const [id,quality,mark] of [['jerboa_stew','very_rare',9],['worm_memorial_bone','legendary',14]]){
|
|
const item=read('DuneRealmsGUI/executableitems/arrakis/'+id+'.yml');assert.equal(p[id].quality,quality);assert.equal(p[id].equipmentMark,mark);assert.ok(item.lore[0].includes(quality.replace('_',' ').toUpperCase()));
|
|
}
|
|
});
|
|
|
|
test('hide becomes paste then four separate, ordinary-crafting-compatible Jerboa Leather',()=>{
|
|
const r=read('DuneRealmsGUI/executablecrafting/recipes/jerboa_leather.yml');
|
|
assert.ok(r.input1.includes('jerboa_hide'));assert.ok(r.input2.includes('jerboa_water_vial'));assert.equal(r.input3,undefined);assert.ok(r.result.includes('jerboa_hide_paste'));
|
|
const native=read('JarvisConnector/src/main/resources/survival-food-recipes.json').smoker.find(r=>r.id==='jerboa_leather');assert.equal(native.input,'jerboa_hide_paste');assert.equal(native.amount,4);
|
|
const paste=read('DuneRealmsGUI/executableitems/arrakis/jerboa_hide_paste.yml'),leather=read('DuneRealmsGUI/executableitems/arrakis/jerboa_leather.yml');assert.equal(leather.material,'LEATHER');assert.match(paste.lore[0],/COMMON \| MK II$/);assert.match(leather.lore[0],/UNCOMMON \| MK III$/);
|
|
});
|
|
|
|
test('Spice Bread inherits the exact enchanted golden apple consumable without scripted effects',()=>{
|
|
const bread=read('DuneRealmsGUI/executableitems/arrakis/spice_bread.yml');assert.equal(bread.material,'ENCHANTED_GOLDEN_APPLE');assert.equal(bread.consumableFeatures,undefined);assert.equal(bread.foodFeatures,undefined);assert.deepEqual(bread.activators,{});assert.equal(bread.itemModel,'dunerealms:ecology/spice_bread');
|
|
});
|
|
|
|
test('Spice Cake requires three custom eggs and water, keeps Rare MK VII and rich food effects',()=>{
|
|
const r=read('DuneRealmsGUI/executablecrafting/recipes/spice_cake.yml');assert.equal([r.input2,r.input3,r.input4].filter(x=>x.includes('jerboa_egg')).length,3);assert.ok(r.input1.includes('spice_dough'));assert.ok(r.input5.includes('jerboa_water_vial'));assert.ok(r.result.includes('"dunerealms:equipment_mark":"7"'));
|
|
const cake=read('DuneRealmsGUI/executableitems/arrakis/spice_cake.yml');assert.equal(cake.foodFeatures.nutrition,16);assert.equal(cake.foodFeatures.saturation,20);assert.deepEqual(Object.values(cake.consumableFeatures.potionEffects).map(x=>x.potionEffectType).sort(),['REGENERATION','STRENGTH']);
|
|
});
|
|
|
|
test('normal and smuggled spice have separate native ingredient checks for both plant recipes',()=>{
|
|
for(const id of ['spice_paste','spice_dough']){const ordinary=read('DuneRealmsGUI/executablecrafting/recipes/'+id+'.yml'),smuggled=read('DuneRealmsGUI/executablecrafting/recipes/'+id+'_smuggled.yml');assert.equal(ordinary.input2,'minecraft:orange_dye');assert.ok(smuggled.input2.includes('"executableitems:ei-id":"smuggled_spice"'));assert.equal(ordinary.result,smuggled.result);assert.equal(ordinary.itemCheckers.checkExecutableItemID,true);}
|
|
});
|

Staff