Module:Stock tickers/NYSE/testcases

From OODA WIKI

Documentation for this module may be created at Module:Stock tickers/NYSE/testcases/doc

-- Example Unit tests for [[Module:Stock tickers/NYSE]]. Click talk page to run tests.
local p = require('Module:UnitTests')

-- Special URLs for preferred shares and when issued.
function p:test_preferred_shares()
    self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | PRE.PRD}}', 'https://www.nyse.com/quote/XNYS:PREpD')
    self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | BCS.PR}}', 'https://www.nyse.com/quote/XNYS:BCSp')
    self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | TPUB.WI}}', 'https://www.nyse.com/quote/XNYS:TPUBw')
end

function p:test_exchanges()
    self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | GE }}', 'https://www.nyse.com/quote/XNYS:GE')
    self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | GE | exchange=NYSE}}', 'https://www.nyse.com/quote/XNYS:GE')
    self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | BTI | exchange=AMEX}}', 'https://www.nyse.com/quote/XASE:BTI')
    self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | SPY | exchange=ARCA}}', 'https://www.nyse.com/quote/ARCX:SPY')
end

return p