Module:TwitterSnowflake/testcases: Difference between revisions
Appearance
Content deleted Content added
mNo edit summary |
uh, try this? Tag: Reverted |
||
Line 3: | Line 3: | ||
function p:test_only_id() -- default date format is "Month Day, Year" |
function p:test_only_id() -- default date format is "Month Day, Year" |
||
self:preprocess_equals('{{#invoke:TwitterSnowflake | snowflakeToDate | id_str = 1345021162959503360}}', 'January 1, 2021') |
self:preprocess_equals('{{#invoke:TwitterSnowflake | snowflakeToDate | id_str = 1345021162959503360}}', 'January 1, 2021 ') |
||
end |
end |
||
Revision as of 15:19, 18 January 2021
![]() | This is the test cases page for the module Module:TwitterSnowflake. Results of the test cases. |
-- Unit tests for [[Module:TwitterSnowflake]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_only_id() -- default date format is "Month Day, Year"
self:preprocess_equals('{{#invoke:TwitterSnowflake | snowflakeToDate | id_str = 1345021162959503360}}', 'January 1, 2021 ')
end
function p:test_custom_output_format() -- tests date format "Day Month Year"
self:preprocess_equals('{{#invoke:TwitterSnowflake | snowflakeToDate | id_str = 1345021162959503360 | format = %e %B %Y}}', '1 January 2021')
end
function p:test_custom_epoch() -- uses Discord's epoch
self:preprocess_equals('{{#invoke:TwitterSnowflake | snowflakeToDate | id_str = 797545051047460888 | epoch = 1420070400}}', 'January 9, 2021')
end
function p:test_weird_breaking_date() -- this one used to break old versions of the script, outputting "April 11, 2011"
self:preprocess_equals('{{#invoke:TwitterSnowflake | snowflakeToDate | id_str = 574608900537761792}}', 'March 8, 2015')
end
return p