Difference between revisions of "Module:Wikidata/testcases"
Jump to navigation
Jump to search
blackwiki>Ans (←Created page with '-- Example Unit tests for Module:Bananas. Click talk page to run tests. local p = require('Module:UnitTests') function p:test_hello() self:preprocess_eq...') |
blackwiki>Ans |
||
| Line 4: | Line 4: | ||
function p:test_hello() | function p:test_hello() | ||
self:preprocess_equals('{{#invoke:Bananas | hello}}', 'Hello, world!') | self:preprocess_equals('{{#invoke:Bananas | hello}}', 'Hello, world!') | ||
| + | self:preprocess_equals('{{#invoke:Wikidata|getValue|P19|FETCH_WIKIDATA}}', '') | ||
| + | self:preprocess_equals('{{#invoke:Wikidata|getValue|P26|FETCH_WIKIDATA}}', '') | ||
| + | self:preprocess_equals('{{#invoke:Wikidata|getValue|P27|FETCH_WIKIDATA}}', '') | ||
| + | self:preprocess_equals('{{#invoke:Wikidata|getValue|P140|FETCH_WIKIDATA}}', '') | ||
| + | self:preprocess_equals('{{#invoke:Wikidata|getRawValue|P21|FETCH_WIKIDATA}}', '') | ||
| + | self:preprocess_equals('{{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|dmy}}', '') | ||
| + | self:preprocess_equals('{{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|mdy}}', '') | ||
| + | self:preprocess_equals('{{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|y}}', '') | ||
end | end | ||
return p | return p | ||
Revision as of 09:29, 28 August 2017
Documentation for this module may be created at Module:Wikidata/testcases/doc
-- Example Unit tests for [[Module:Bananas]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_hello()
self:preprocess_equals('{{#invoke:Bananas | hello}}', 'Hello, world!')
self:preprocess_equals('{{#invoke:Wikidata|getValue|P19|FETCH_WIKIDATA}}', '')
self:preprocess_equals('{{#invoke:Wikidata|getValue|P26|FETCH_WIKIDATA}}', '')
self:preprocess_equals('{{#invoke:Wikidata|getValue|P27|FETCH_WIKIDATA}}', '')
self:preprocess_equals('{{#invoke:Wikidata|getValue|P140|FETCH_WIKIDATA}}', '')
self:preprocess_equals('{{#invoke:Wikidata|getRawValue|P21|FETCH_WIKIDATA}}', '')
self:preprocess_equals('{{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|dmy}}', '')
self:preprocess_equals('{{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|mdy}}', '')
self:preprocess_equals('{{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|y}}', '')
end
return p