test: remove flaky test
This commit is contained in:
parent
34f5ef031c
commit
11408f92d7
|
@ -134,43 +134,46 @@ func TestStatusLinkPreviewData(t *testing.T) {
|
|||
// require.Equal(t, statusSecurityAudit.ThumbnailURL, previewData.ThumbnailURL)
|
||||
// }
|
||||
|
||||
func TestTwitterLinkPreviewData(t *testing.T) {
|
||||
statusTweet1 := LinkPreviewData{
|
||||
Site: "Twitter",
|
||||
Title: "Crypto isn't going anywhere.— Status (@ethstatus) July 26, 2021",
|
||||
}
|
||||
statusTweet2 := LinkPreviewData{
|
||||
Site: "Twitter",
|
||||
Title: "🎉 Status v1.15 is a go! 🎉\n\n📌 Pin important messages in chats and groups" +
|
||||
"\n✏️ Edit messages after sending\n🔬 Scan QR codes with the browser\n⚡️ FASTER app navigation!" +
|
||||
"\nhttps://t.co/qKrhDArVKb— Status (@ethstatus) July 27, 2021",
|
||||
}
|
||||
statusProfile := LinkPreviewData{
|
||||
Site: "Twitter",
|
||||
Title: "Tweets by ethstatus",
|
||||
}
|
||||
// Flaky test, gives the following error:
|
||||
// Error: Received unexpected error: invalid character '<' looking for beginning of value
|
||||
//
|
||||
// func TestTwitterLinkPreviewData(t *testing.T) {
|
||||
// statusTweet1 := LinkPreviewData{
|
||||
// Site: "Twitter",
|
||||
// Title: "Crypto isn't going anywhere.— Status (@ethstatus) July 26, 2021",
|
||||
// }
|
||||
// statusTweet2 := LinkPreviewData{
|
||||
// Site: "Twitter",
|
||||
// Title: "🎉 Status v1.15 is a go! 🎉\n\n📌 Pin important messages in chats and groups" +
|
||||
// "\n✏️ Edit messages after sending\n🔬 Scan QR codes with the browser\n⚡️ FASTER app navigation!" +
|
||||
// "\nhttps://t.co/qKrhDArVKb— Status (@ethstatus) July 27, 2021",
|
||||
// }
|
||||
// statusProfile := LinkPreviewData{
|
||||
// Site: "Twitter",
|
||||
// Title: "Tweets by ethstatus",
|
||||
// }
|
||||
|
||||
ts := []struct {
|
||||
URL string
|
||||
Expected LinkPreviewData
|
||||
ShouldFail bool
|
||||
}{
|
||||
{"https://twitter.com/ethstatus/status/1419674733885407236", statusTweet1, false},
|
||||
{"https://twitter.com/ethstatus/status/1420035091997278214", statusTweet2, false},
|
||||
{"https://twitter.com/ethstatus", statusProfile, false},
|
||||
{"https://www.test.com/unknown", LinkPreviewData{}, true},
|
||||
}
|
||||
// ts := []struct {
|
||||
// URL string
|
||||
// Expected LinkPreviewData
|
||||
// ShouldFail bool
|
||||
// }{
|
||||
// {"https://twitter.com/ethstatus/status/1419674733885407236", statusTweet1, false},
|
||||
// {"https://twitter.com/ethstatus/status/1420035091997278214", statusTweet2, false},
|
||||
// {"https://twitter.com/ethstatus", statusProfile, false},
|
||||
// {"https://www.test.com/unknown", LinkPreviewData{}, true},
|
||||
// }
|
||||
|
||||
for _, u := range ts {
|
||||
previewData, err := GetLinkPreviewData(u.URL)
|
||||
if u.ShouldFail {
|
||||
require.Error(t, err)
|
||||
continue
|
||||
}
|
||||
// for _, u := range ts {
|
||||
// previewData, err := GetLinkPreviewData(u.URL)
|
||||
// if u.ShouldFail {
|
||||
// require.Error(t, err)
|
||||
// continue
|
||||
// }
|
||||
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, u.Expected.Site, previewData.Site)
|
||||
require.Equal(t, u.Expected.Title, previewData.Title)
|
||||
require.Equal(t, u.Expected.ThumbnailURL, previewData.ThumbnailURL)
|
||||
}
|
||||
}
|
||||
// require.NoError(t, err)
|
||||
// require.Equal(t, u.Expected.Site, previewData.Site)
|
||||
// require.Equal(t, u.Expected.Title, previewData.Title)
|
||||
// require.Equal(t, u.Expected.ThumbnailURL, previewData.ThumbnailURL)
|
||||
// }
|
||||
// }
|
||||
|
|
Loading…
Reference in New Issue