From 12a47b78930a2202d36a32097a8869b98511e05f Mon Sep 17 00:00:00 2001 From: Shivek Khurana Date: Wed, 20 Jan 2021 18:01:11 +0530 Subject: [PATCH] Ignore Giphy load balancer urls --- protocol/urls/urls_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/protocol/urls/urls_test.go b/protocol/urls/urls_test.go index f595c69b7..d4ffa862b 100644 --- a/protocol/urls/urls_test.go +++ b/protocol/urls/urls_test.go @@ -2,6 +2,7 @@ package urls import ( "testing" + "strings" "github.com/stretchr/testify/require" ) @@ -42,7 +43,10 @@ func TestGetGiphyPreviewData(t *testing.T) { require.NoError(t, err) require.Equal(t, bostonDynamicsEthGifData.Site, previewData.Site) require.Equal(t, bostonDynamicsEthGifData.Title, previewData.Title) - require.Equal(t, bostonDynamicsEthGifData.ThumbnailURL, previewData.ThumbnailURL) + + // Giphy oembed returns links to different servers: https://media1.giphy.com, https://media2.giphy.com and so on + // We don't care about the server as long as other parts are equal, so we split at "." and ignore the first item + require.Equal(t, strings.Split(bostonDynamicsEthGifData.ThumbnailURL, ".")[1:], strings.Split(previewData.ThumbnailURL, ".")[1:]) invalidGiphyLink := "https://giphy.com/gifs/this-gif-does-not-exist-44444" _, err = GetGiphyPreviewData(invalidGiphyLink)