Add spec for extract_plid

This commit is contained in:
Omar Roth 2020-03-30 14:23:51 -05:00
parent 3b2e142542
commit 80fc60b5e2
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2

View File

@ -9,6 +9,7 @@ require "../src/invidious/channels"
require "../src/invidious/comments" require "../src/invidious/comments"
require "../src/invidious/playlists" require "../src/invidious/playlists"
require "../src/invidious/search" require "../src/invidious/search"
require "../src/invidious/trending"
require "../src/invidious/users" require "../src/invidious/users"
describe "Helper" do describe "Helper" do
@ -124,6 +125,15 @@ describe "Helper" do
end end
end end
describe "#extract_plid" do
it "correctly extracts playlist ID from trending URL" do
extract_plid("/feed/trending?bp=4gIuCggvbS8wNHJsZhIiUExGZ3F1TG5MNTlhbVBud2pLbmNhZUp3MDYzZlU1M3Q0cA%3D%3D").should eq("PLFgquLnL59amPnwjKncaeJw063fU53t4p")
extract_plid("/feed/trending?bp=4gIvCgkvbS8wYnp2bTISIlBMaUN2Vkp6QnVwS2tDaFNnUDdGWFhDclo2aEp4NmtlTm0%3D").should eq("PLiCvVJzBupKkChSgP7FXXCrZ6hJx6keNm")
extract_plid("/feed/trending?bp=4gIuCggvbS8wNWpoZxIiUEwzWlE1Q3BOdWxRbUtPUDNJekdsYWN0V1c4dklYX0hFUA%3D%3D").should eq("PL3ZQ5CpNulQmKOP3IzGlactWW8vIX_HEP")
extract_plid("/feed/trending?bp=4gIuCggvbS8wMnZ4bhIiUEx6akZiYUZ6c21NUnFhdEJnVTdPeGNGTkZhQ2hqTkVERA%3D%3D").should eq("PLzjFbaFzsmMRqatBgU7OxcFNFaChjNEDD")
end
end
describe "#sign_token" do describe "#sign_token" do
it "correctly signs a given hash" do it "correctly signs a given hash" do
token = { token = {