From 80fc60b5e2d0d2c421b7993495398272c751ec3b Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Mon, 30 Mar 2020 14:23:51 -0500 Subject: [PATCH] Add spec for extract_plid --- spec/helpers_spec.cr | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/helpers_spec.cr b/spec/helpers_spec.cr index 95222e0b..37e36c61 100644 --- a/spec/helpers_spec.cr +++ b/spec/helpers_spec.cr @@ -9,6 +9,7 @@ require "../src/invidious/channels" require "../src/invidious/comments" require "../src/invidious/playlists" require "../src/invidious/search" +require "../src/invidious/trending" require "../src/invidious/users" describe "Helper" do @@ -124,6 +125,15 @@ describe "Helper" do 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 it "correctly signs a given hash" do token = {