From 9970b921573ad61cac68bee56ff4f061b9a20c81 Mon Sep 17 00:00:00 2001 From: Andrew Miner Date: Sat, 10 Jan 2015 12:13:43 -0800 Subject: [PATCH] Fix broken tests for gatherNames --- src/scripts/models/mod_version.coffee | 2 +- test/mod_pack.test.coffee | 14 +++++++------- test/mod_version.test.coffee | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/scripts/models/mod_version.coffee b/src/scripts/models/mod_version.coffee index f53c7942f..3a359490c 100644 --- a/src/scripts/models/mod_version.coffee +++ b/src/scripts/models/mod_version.coffee @@ -58,7 +58,7 @@ module.exports = class ModVersion extends BaseModel for slug, item of @items continue if result[item.slug] - if item.isGatherable + if not item.isCraftable continue unless options.includeGatherable result[item.slug] = value:item.name, label:"#{item.name} (from #{@name} #{@version})" diff --git a/test/mod_pack.test.coffee b/test/mod_pack.test.coffee index 4bb01e43d..6bc7aa9d8 100644 --- a/test/mod_pack.test.coffee +++ b/test/mod_pack.test.coffee @@ -99,32 +99,32 @@ describe 'ModPack', -> display.itemName.should.equal 'Iron Chestplate' display.modSlug.should.equal 'minecraft' - describe 'gatherRecipeNames', -> + describe 'gatherNames', -> it 'finds all registered item names', -> buildcraft.enabled = true industrialCraft.enabled = true - (i.value for i in modPack.gatherRecipeNames()).sort().should.eql ['Bed', 'Rubber', 'Stone Gear'] + (i.value for i in modPack.gatherNames()).sort().should.eql ['Bed', 'Rubber', 'Stone Gear'] it 'ignores duplicate item names', -> buildcraft.enabled = true - names = modPack.gatherRecipeNames() + names = modPack.gatherNames() bedName = (e for e in names when e.value is 'Bed')[0] bedName.should.eql value:'Bed', label:'Bed (from Minecraft 1.7.10)' it 'alphabetizes the item names', -> buildcraft.enabled = true industrialCraft.enabled = true - (i.value for i in modPack.gatherRecipeNames()).should.eql ['Bed', 'Rubber', 'Stone Gear'] + (i.value for i in modPack.gatherNames()).should.eql ['Bed', 'Rubber', 'Stone Gear'] it 'ignores non-craftable items', -> - (n.value for n in modPack.gatherRecipeNames()).sort().should.eql ['Bed'] + (n.value for n in modPack.gatherNames()).sort().should.eql ['Bed'] it 'ignores disabled mod versions', -> - (n.value for n in modPack.gatherRecipeNames()).should.not.include 'Stone Gear' + (n.value for n in modPack.gatherNames()).should.not.include 'Stone Gear' it "doesn't ignore disabled mod versions when include disabled is requested", -> - (n.value for n in modPack.gatherRecipeNames(includeDisabled:true)).should.include 'Stone Gear' + (n.value for n in modPack.gatherNames(includeDisabled:true)).should.include 'Stone Gear' describe 'hasRecipe', -> diff --git a/test/mod_version.test.coffee b/test/mod_version.test.coffee index a08dd5bfc..838a4466a 100644 --- a/test/mod_version.test.coffee +++ b/test/mod_version.test.coffee @@ -59,24 +59,24 @@ describe 'ModVersion', -> modVersion.addItem new Item name:'Crafting Table' modVersion.findItemByName('Crafting Table').slug.should.equal 'crafting_table' - describe 'gatherRecipeNames', -> + describe 'gatherNames', -> it 'skips names already found', -> modVersion.addItem new Item name:'Wool' modVersion.addItem new Item name:'Oak Wood Planks', recipes:['foo'] - names = modVersion.gatherRecipeNames {wool:true} + names = modVersion.gatherNames {wool:true} names.wool.should.be.true names.oak_wood_planks.value.should.equal 'Oak Wood Planks' it 'only includes craftable items', -> modVersion.addItem new Item name:'Wool' modVersion.addItem new Item name:'Oak Wood Planks', recipes:['foo'] - names = modVersion.gatherRecipeNames() + names = modVersion.gatherNames() _.keys(names).should.eql ['oak_wood_planks'] it 'computes the proper value and label', -> modVersion.addItem new Item name:'Oak Wood Planks', recipes:['foo'] - names = modVersion.gatherRecipeNames() + names = modVersion.gatherNames() names.oak_wood_planks.value.should.equal 'Oak Wood Planks' names.oak_wood_planks.label.should.equal 'Oak Wood Planks (from Test 0.0)'