Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a21ec980cbd1994c

Jump to content

Module:SocialMediaStats/testcases

From Wikipedia, the free encyclopedia
-- Unit tests for [[Module:{{ROOTPAGENAME}}]]. Click talk page to run tests.
local p = require('Module:UnitTests')


function p:test_Empty()
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTsubscribers | qid=Q111862397 | }}', '')
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTviews | qid=Q111862397 | }}', '')
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTdate | qid=Q111862397 | }}', '')
end

function p:test_YTsubscribers_basic()
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTsubscribers | qid=Q111862397 | youtube_handle=LinusTechTips}}', '',{noexpectation=1})
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTsubscribers | qid=Q111862397 | youtube_handle=linustechtips}}', '',{noexpectation=1})
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTsubscribers | qid=Q111862397 | youtube_id=UCXuqSBlHAE6Xw-yeJA0Tunw }}', '',{noexpectation=1})
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTsubscribers | qid=Q13423853 | youtube_handle=PewDiePie  }}', '',{noexpectation=1})
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTsubscribers | qid=Q13423853 | youtube_handle=pewdiepie  }}', '',{noexpectation=1})
	
end

function p:test_YTsubscribers_multi()
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTsubscribers | qid=Q57618112 | youtube_handle=MrBeast | youtube_handle2=MrBeastGaming}}', '',{noexpectation=1})
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTsubscribers | qid=Q57618112 | youtube_id=UCX6OQ3DkcsbYNE6H8uQQuVA | youtube_handle2=MrBeastGaming}}', '',{noexpectation=1})	
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTsubscribers | qid=Q57618112 | youtube_handle=MrBeast | youtube_handle2=UCIPPMRA040LQr5QPyJEbmXA}}', '',{noexpectation=1})
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTsubscribers | qid=Q57618112 | youtube_id=UCX6OQ3DkcsbYNE6H8uQQuVA | youtube_handle2=UCIPPMRA040LQr5QPyJEbmXA}}', '',{noexpectation=1})
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTsubscribers | qid=Q57618112 | youtube_id=UCX6OQ3DkcsbYNE6H8uQQuVA | youtube_handle2=}}', '',{noexpectation=1})
	
end


function p:test_YTdate_basic()
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTdate | qid=Q111862397 | youtube_handle=LinusTechTips}}', '',{noexpectation=1})
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTdate | qid=Q57618112 | youtube_handle=MrBeast}}', '',{noexpectation=1})
	
end

function p:test_YTdate_multi()
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTdate | qid=Q57618112 | youtube_handle=MrBeast | youtube_handle2=MrBeastGaming}}', '',{noexpectation=1})
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTdate | qid=Q57618112 | youtube_handle=MrBeast | youtube_handle2=MrBeastGaming}}', '',{noexpectation=1})
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTdate | qid=Q57618112 | youtube_handle=MrBeast | youtube_handle2=}}', '',{noexpectation=1})
	
end

function p:test_YTviews_basic()
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTviews | qid=Q111862397 | youtube_handle=LinusTechTips}}', '',{noexpectation=1})
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTviews | qid=Q111862397 | youtube_handle=linustechTips}}', '',{noexpectation=1})
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTviews | qid=Q111862397 | youtube_id=UCXuqSBlHAE6Xw-yeJA0Tunw }}', '',{noexpectation=1})
	
end


function p:test_YTviews_multi()
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTviews | qid=Q57618112 | youtube_handle=MrBeast | youtube_handle2=MrBeastGaming}}', '',{noexpectation=1})
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTviews | qid=Q57618112 | youtube_handle=MrBeast | youtube_handle2=MrBeastGaming}}', '',{noexpectation=1})
	self:preprocess_equals('{{#invoke:SocialMediaStats | YTviews | qid=Q57618112 | youtube_handle=MrBeast | youtube_handle2=}}', '',{noexpectation=1})
	
end

return p