-- Unit tests for [[Module:TFA title]]. Click talk page to run tests.
local p = require('Module:UnitTests')
local tfa = require('Module:TFA title')

function p:test()
	self:equals_deep("Title on 2004-02-22", tfa.title("2004-02-22"), 'Wolfgang Amadeus Mozart')
	self:equals_deep("Titles on 2008-11-04", tfa.title("2008-11-04"), {"John McCain", "Barack Obama"})
	self:equals_deep("Titles on 3000-01-01", tfa.title("3000-01-01"), nil)

	self:equals_deep("Is TFA on 2004-02-22 - correct", tfa.is_tfa_on("Wolfgang Amadeus Mozart", "2004-02-22"), "yes")
	self:equals_deep("Is TFA on 2004-02-22 - wrong", tfa.is_tfa_on("Main Page", "2004-02-22"), "")
	self:equals_deep("Is TFA on 2008-11-04 - correct", tfa.is_tfa_on("John McCain", "2008-11-04"), "yes")
	self:equals_deep("Is TFA on 2008-11-04 - correct", tfa.is_tfa_on("Barack Obama", "2008-11-04"), "yes")
	self:equals_deep("Is TFA on 2008-11-04 - wrong", tfa.is_tfa_on("Main Page", "2008-11-04"), "")
	self:equals_deep("Is TFA on 3000-01-01 - no data", tfa.is_tfa_on("Main Page", "3000-01-01"), "")


end

return p