Dota 2 Wiki
Advertisement
Dota 2 Wiki
20,262
pages

Documentation for this module may be created at Module:Ability icon/testcases/doc

local aicon = require('Module:Ability icon') -- the module to be tested
local ScribuntoUnit = require('Module:ScribuntoUnit')
local suite = ScribuntoUnit:new()



--------------------------------------------------------------------------------
-- Basic tests
--------------------------------------------------------------------------------

function suite:testNormalAbility()
    self:assertEquals('File:Tether icon.png', aicon.main({name='Tether', source='Io'}))
end

function suite:testItemAbility()
    self:assertEquals('File:Battle Fury icon.png', aicon.main({name='Cleave', source='Battle Fury'}))
end

function suite:testRuneAbility()
    self:assertEquals('File:Bottle (Haste) icon.png', aicon.main({name='Haste', source='Haste Rune'}))
end

--------------------------------------------------------------------------------
-- Test no name.
--------------------------------------------------------------------------------

function suite:testItem()
    self:assertEquals('File:Battle Fury icon.png', aicon.main({source='Battle Fury'}))
end

--------------------------------------------------------------------------------
-- Test given data
--------------------------------------------------------------------------------
function suite:testGivenData()
    local data = {
      type = 'hero',
      image = 'File:Not Tethers icon.png'
    }
    self:assertEquals('File:Not Tethers icon.png', aicon._main({name='Tether', source='Io'}, data))
end

--------------------------------------------------------------------------------
-- Test default icon
--------------------------------------------------------------------------------
function suite:testDefault()
    local data = {
      type = 'hero',
      image = ''
    }
    self:assertEquals('File:Unknown icon.png', aicon._main({name='Tether', source='Io'}, data))
end


return suite
Advertisement