chore_: uncomment tests (#5792)

* chore_: uncomment tests

* chore_: better comment

Co-authored-by: osmaczko <33099791+osmaczko@users.noreply.github.com>
This commit is contained in:
Igor Sirotin 2024-09-03 12:40:50 +01:00 committed by GitHub
parent 4083aae162
commit beaca5faf7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 59 additions and 59 deletions

View File

@ -118,62 +118,62 @@ func TestStatusLinkPreviewData(t *testing.T) {
}
// Medium unfurling is failing - https://github.com/status-im/status-go/issues/2192
//
// func TestMediumLinkPreviewData(t *testing.T) {
// statusSecurityAudit := LinkPreviewData{
// Site: "Medium",
// Title: "A Look at the Status.im ICO Token Distribution",
// ThumbnailURL: "https://miro.medium.com/max/700/1*Smc0y_TOL1XsofS1wxa3rg.jpeg",
// }
func TestMediumLinkPreviewData(t *testing.T) {
t.Skip("broken test") // https://github.com/status-im/status-go/issues/2192
// previewData, err := GetLinkPreviewData("https://medium.com/the-bitcoin-podcast-blog/a-look-at-the-status-im-ico-token-distribution-f5bcf7f00907")
// require.NoError(t, err)
// require.Equal(t, statusSecurityAudit.Site, previewData.Site)
// require.Equal(t, statusSecurityAudit.Title, previewData.Title)
// require.Equal(t, statusSecurityAudit.ThumbnailURL, previewData.ThumbnailURL)
// }
statusSecurityAudit := LinkPreviewData{
Site: "Medium",
Title: "A Look at the Status.im ICO Token Distribution",
ThumbnailURL: "https://miro.medium.com/max/700/1*Smc0y_TOL1XsofS1wxa3rg.jpeg",
}
// 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",
// }
previewData, err := GetLinkPreviewData("https://medium.com/the-bitcoin-podcast-blog/a-look-at-the-status-im-ico-token-distribution-f5bcf7f00907")
require.NoError(t, err)
require.Equal(t, statusSecurityAudit.Site, previewData.Site)
require.Equal(t, statusSecurityAudit.Title, previewData.Title)
require.Equal(t, statusSecurityAudit.ThumbnailURL, previewData.ThumbnailURL)
}
// 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},
// }
func TestTwitterLinkPreviewData(t *testing.T) {
t.Skip("flaky test") // https://github.com/status-im/status-go/issues/3529
// for _, u := range ts {
// previewData, err := GetLinkPreviewData(u.URL)
// if u.ShouldFail {
// require.Error(t, err)
// continue
// }
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",
}
// 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)
// }
// }
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
}
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)
}
}

View File

@ -145,12 +145,12 @@ func TestResourceURL(t *testing.T) {
require.Equal(t, "bafybeidzlqpkbtvpjtxnzgew6ffxhozq5f4ojbk64iq3tjl7lkjue2biby", uri.Host)
require.Equal(t, "", uri.Path)
//fixme: this is not working ATM, as it blocks PRs, i commented it out
//uri, err = api.ResourceURL(context.Background(), 1, "swarm.eth")
//require.NoError(t, err)
//require.Equal(t, "https", uri.Scheme)
//require.Equal(t, "swarm-gateways.net", uri.Host)
//require.Equal(t, "/bzz:/b7976f7fabd7ba88a897452a2860228dcefec427302a3dedae164b51c780a5b8/", uri.Path)
//fixme: this block is the broken part
uri, err = api.ResourceURL(context.Background(), 1, "swarm.eth")
require.NoError(t, err)
require.Equal(t, "https", uri.Scheme)
require.Equal(t, "swarm-gateways.net", uri.Host)
require.Equal(t, "/bzz:/b7976f7fabd7ba88a897452a2860228dcefec427302a3dedae164b51c780a5b8/", uri.Path)
uri, err = api.ResourceURL(context.Background(), 1, "noahzinsmeister.eth")
require.NoError(t, err)