Module:Book link/testcases
Appearance
This is the test cases page for the module Module:Book link. Results of the test cases. |
local p = require('Module:UnitTests')
local BookLink = require('Module:Book link')
local Creator = require('Module:Creator')
function p:test_edition()
local testCaseName = 'An edition'
local params = {
title = 'My Title',
authors = {
Creator.newCreator( 'Q37160' ) -- David Hume
},
year = 1234
}
local expected = '<span class="wst-worklink"><span class="wst-worklink-title">[[My Title|My Title]]</span> by <span class="wst-worklink-authors"><span class="wst-worklink-creator">[[Author:David Hume|David Hume]]</span></span> (<span class="wst-worklink-date">1234</span>)</span>'
local link = BookLink.renderLink( params )
self:equals( testCaseName, tostring( link ), expected, { nowiki = true } )
end
return p