Jump to content

Module:Stock tickers/NYSE/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Svgalbertian (talk | contribs) at 13:51, 3 August 2014 (add tests cases for different exchanges). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- Example Unit tests for [[Module:Stock tickers/NYSE]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_preferred_shares()
    self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | PRE.PRD}}', 'http://www.nyse.com/quote/XNYS:PREpD')
    self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | BCS.PR}}', 'http://www.nyse.com/quote/XNYS:BCSp')
end

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

return p