Fix broken tests for gatherNames

This commit is contained in:
Andrew Miner
2015-01-10 12:13:43 -08:00
parent 9756f1f045
commit 9970b92157
3 changed files with 12 additions and 12 deletions
+7 -7
View File
@@ -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', ->
+4 -4
View File
@@ -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)'