artstation: add tests for #4480.

This commit is contained in:
evazion
2020-05-27 15:49:04 -05:00
parent 241894428a
commit 71f4e5b82a

View File

@@ -11,6 +11,10 @@ module Sources
assert_equal("https://cdn.artstation.com/p/assets/images/images/000/705/368/4k/jey-rain-one1.jpg", @site.image_url.sub(/\?\d+/, ""))
end
should "get the preview url" do
assert_equal("https://cdn.artstation.com/p/assets/images/images/000/705/368/small/jey-rain-one1.jpg", @site.preview_url.sub(/\?\d+/, ""))
end
should "get the canonical url" do
assert_equal("https://jeyrain.artstation.com/projects/04XA4", @site.canonical_url)
end
@@ -43,6 +47,11 @@ module Sources
assert_equal(url, @site.image_url)
end
should "get the preview url" do
url = "https://cdn.artstation.com/p/assets/images/images/006/066/534/small/yinan-cui-reika.jpg?1495781565"
assert_equal(url, @site.preview_url)
end
should "get the canonical url" do
assert_equal("https://dantewontdie.artstation.com/projects/YZK5q", @site.canonical_url)
end
@@ -76,6 +85,11 @@ module Sources
assert_equal(url, @site.image_url)
end
should "get the preview url" do
url = "https://cdn.artstation.com/p/assets/images/images/000/144/922/small/cassio-yoshiyaki-cody2backup2-yoshiyaki.jpg?1406314198"
assert_equal(url, @site.preview_url)
end
should "get the tags" do
assert_equal(["Street Fighter", "Cody", "SF"].sort, @site.tags.map(&:first).sort)
assert_equal(["street_fighter", "cody", "sf"].sort, @site.normalized_tags.sort)
@@ -126,6 +140,16 @@ module Sources
end
end
context "A cover url" do
should "work" do
url = "https://cdna.artstation.com/p/assets/covers/images/007/262/828/large/monica-kyrie-1.jpg?1504865060"
site = Sources::Strategies.find(url)
assert_equal("https://cdn.artstation.com/p/assets/covers/images/007/262/828/original/monica-kyrie-1.jpg?1504865060", site.image_url)
assert_equal("https://cdn.artstation.com/p/assets/covers/images/007/262/828/small/monica-kyrie-1.jpg?1504865060", site.preview_url)
end
end
context "The source site for an ArtStation gallery" do
setup do
@site = Sources::Strategies.find("https://www.artstation.com/artwork/BDxrA")