Skip to content

Commit

Permalink
tests fixed, libs upgraded
Browse files Browse the repository at this point in the history
  • Loading branch information
sdfsdhgjkbmnmxc committed Jul 21, 2021
1 parent 2cb7edd commit 76f7807
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 28 deletions.
25 changes: 13 additions & 12 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,21 @@ func TestPreview(t *testing.T) {
Title: "Шанти-трэш",
},
"https://habr.com/ru/post/354472/": {
ThumbnailUrl: "https://habr.com/share/publication/354472/590e252e0c6748a2c367a8c72a67c422/?v=1",
ThumbnailUrl: "https://habr.com/share/publication/354472/590e252e0c6748a2c367a8c72a67c422/",
Title: "Бэкап переписки в telegram",
},
"https://yandex.ru/maps/213/moscow/?ll=37.656245%2C55.759324&mode=search&oid=1111668074&ol=biz&sctx=ZAAAAAgCEAAaKAoSCYnQCDauz0JAEabtX1lp4EtAEhIJA137Anqh8j8RmPxP%2Fu4d7D8iBQABAgQFKAAwATi47Z3olunF%20cQBQNUBSAFVzczMPlgAYiRtaWRkbGVfYXNrX2RpcmVjdF9xdWVyeV90eXBlcz1ydWJyaWNiKG1pZGRsZV9pbmZsYXRlX2RpcmVjdF9maWx0ZXJfd2luZG93PTUwMDBiEnJlbGV2X2RydWdfYm9vc3Q9MWJEbWlkZGxlX2RpcmVjdF9zbmlwcGV0cz1waG90b3MvMi54LGJ1c2luZXNzcmF0aW5nLzIueCxtYXNzdHJhbnNpdC8xLnhiNW1pZGRsZV93aXpleHRyYT10cmF2ZWxfY2xhc3NpZmllcl92YWx1ZT0wLjAxOTcyODM2MjU2YidtaWRkbGVfd2l6ZXh0cmE9YXBwbHlfZmVhdHVyZV9maWx0ZXJzPTFiKG1pZGRsZV93aXpleHRyYT1vcmdtbl93YW5kX3RocmVzaG9sZD0wLjliKW1pZGRsZV93aXpleHRyYT1yZXF1ZXN0X3NvZnRfdGltZW91dD0wLjA1YiNtaWRkbGVfd2l6ZXh0cmE9dHJhbnNpdF9hbGxvd19nZW89MWI9bWlkZGxlX3dpemV4dHJhPXRyYXZlbF9jbGFzc2lmaWVyX29yZ21hbnlfdmFsdWU9MC4wMTY0ODYxNDkyOGIebWlkZGxlX2Fza19kaXJlY3RfcGVybWFsaW5rcz0xYiptaWRkbGVfaW5mbGF0ZV9kaXJlY3RfcmVxdWVzdF93aW5kb3c9MTAwMDBiHXJlbGV2X2ZpbHRlcl9nd2tpbmRzPTAuMywwLjQ1YilyZWFycj1zY2hlbWVfTG9jYWwvR2VvL0FsbG93VHJhdmVsQm9vc3Q9MWIxcmVhcnI9c2NoZW1lX0xvY2FsL0dlb3VwcGVyL2ZlYXR1cmVzRnJvbU9iamVjdHM9MWIvcmVhcnI9c2NoZW1lX0xvY2FsL0dlby9Qb3N0ZmlsdGVyL0Fic1RocmVzaD0wLjJiKXJlYXJyPXNjaGVtZV9Mb2NhbC9HZW8vQ3V0QWZpc2hhU25pcHBldD0xYjVyZWFycj1zY2hlbWVfTG9jYWwvR2VvL0hvdGVsQm9vc3Q9bWVhbl9jb252ZXJzaW9uXzEyd2IpcmVhcnI9c2NoZW1lX0xvY2FsL0dlby9Vc2VHZW9UcmF2ZWxSdWxlPTFqAnJ1cAGVAQAAAACdAc3MTD6gAQGoAQC9ASpEmwfCAQvq6oqSBLSz54m4Bg%3D%3D&sll=37.656245%2C55.759324&source=wizbiz_new_map_single&text=copyprint%20%D0%BA%D1%83%D1%80%D1%81%D0%BA%D0%B0%D1%8F&z=14": {
ThumbnailUrl: "https://avatars.mds.yandex.net/get-altay/910613/2a000001622d8e17052f70e2a85a00c18bfe/L",
Title: "Copyprint, копировальный центр, Яковоапостольский пер., 17 — Яндекс.Карты",
},
// FIXME: moved to js
//"https://yandex.ru/maps/213/moscow/?ll=37.656245%2C55.759324&mode=search&oid=1111668074&ol=biz&sctx=ZAAAAAgCEAAaKAoSCYnQCDauz0JAEabtX1lp4EtAEhIJA137Anqh8j8RmPxP%2Fu4d7D8iBQABAgQFKAAwATi47Z3olunF%20c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vc3Q9bWVhbl9jb252ZXJzaW9uXzEyd2IpcmVhcnI9c2NoZW1lX0xvY2FsL0dlby9Vc2VHZW9UcmF2ZWxSdWxlPTFqAnJ1cAGVAQAAAACdAc3MTD6gAQGoAQC9ASpEmwfCAQvq6oqSBLSz54m4Bg%3D%3D&sll=37.656245%2C55.759324&source=wizbiz_new_map_single&text=copyprint%20%D0%BA%D1%83%D1%80%D1%81%D0%BA%D0%B0%D1%8F&z=14": {
// ThumbnailUrl: "https://avatars.mds.yandex.net/get-altay/910613/2a000001622d8e17052f70e2a85a00c18bfe/L",
// Title: "Copyprint, копировальный центр, Яковоапостольский пер., 17 — Яндекс.Карты",
//},
"http://hidemyname.link/EN8f3g": {
ThumbnailUrl: "https://hidemy.name/media/img/news/evropejskim-chinovnikam-rekomendujut-udalit-whatsapp-i-facebook-messenger.jpg",
Title: "Европейским чиновникам рекомендуют удалить WhatsApp и Facebook Messenger",
},
"https://cl.ly/391E2W3E111s": {
ThumbnailUrl: "https://f.v1.n0.cdn.getcloudapp.com/items/3P0J3Z3y1o380L2l3X36/Image%202016-09-15%20at%2012.02.06%20PM.png",
Title: "Image 2016-09-15 at 12.02.06 PM.png",
Title: "Image 2016-09-15 at 12.02.06 PM",
},
"https://meduza.io/shapito/2020/04/22/vsegda-priyatno-posmotret-na-usatyh-loshadey-a-kogda-tak-malo-horoshih-novostey-tem-bolee": {
ThumbnailUrl: "https://meduza.io/imgly/share/1587572704/shapito/2020/04/22/vsegda-priyatno-posmotret-na-usatyh-loshadey-a-kogda-tak-malo-horoshih-novostey-tem-bolee",
Expand All @@ -58,15 +59,15 @@ func TestPreview(t *testing.T) {
},
"https://github.com/meetecho/janus-gateway": {
ThumbnailUrl: "https://repository-images.githubusercontent.com/16734696/cb265c80-651c-11ea-9c93-c54a2d2284e7",
Title: "meetecho/janus-gateway",
//Title: "GitHub - meetecho/janus-gateway: Janus WebRTC Server",
Title: "GitHub - meetecho/janus-gateway: Janus WebRTC Server",
//Title: "meetecho/janus-gateway",
},
// FIXME: stopped after 10 redirects
//"https://developer.android.com/guide/topics/connectivity/telecom": {
// Title: "Telecom framework overview |",
//},
"https://habr.com/ru/": {
ThumbnailUrl: "https://habr.com/images/habr_ru.png",
ThumbnailUrl: "https://habr.com/img/habr_en.png",
Title: "Все публикации подряд / Хабр",
},
} {
Expand All @@ -76,13 +77,13 @@ func TestPreview(t *testing.T) {
t.Fatal(err)
}
if testCase.ThumbnailUrl != "" && result.ThumbnailUrl != testCase.ThumbnailUrl {
t.Error("invalid ThumbnailUrl:\nwant:", testCase.ThumbnailUrl, "\ngot:", result.ThumbnailUrl)
t.Errorf("invalid ThumbnailUrl:\nwant: `%s`\ngot: `%s`", testCase.ThumbnailUrl, result.ThumbnailUrl)
}
if !strings.HasPrefix(result.Title, testCase.Title) {
t.Error("invalid Title: want:", testCase.Title, " got:", result.Title)
t.Errorf("invalid Title:\nwant: `%s`\ngot: `%s`", testCase.Title, result.Title)
}
if result.YoutubeId != testCase.YoutubeId {
t.Error("invalid YoutubeId: want:", testCase.YoutubeId, "got:", result.YoutubeId)
t.Errorf("invalid YoutubeId:\nwant: `%s`\ngot: `%s`", testCase.YoutubeId, result.YoutubeId)
}
})
}
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module github.com/tada-team/dyatl
go 1.14

require (
github.com/PuerkitoBio/goquery v1.6.0
github.com/PuerkitoBio/goquery v1.7.1
github.com/pkg/errors v0.9.1
golang.org/x/net v0.0.0-20201224014010-6772e930b67b
golang.org/x/text v0.3.4
golang.org/x/net v0.0.0-20210716203947-853a461950ff
golang.org/x/text v0.3.6
)
23 changes: 10 additions & 13 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
github.com/PuerkitoBio/goquery v1.6.0 h1:j7taAbelrdcsOlGeMenZxc2AWXD5fieT1/znArdnx94=
github.com/PuerkitoBio/goquery v1.6.0/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/andybalholm/cascadia v1.1.0 h1:BuuO6sSfQNFRu1LppgbD25Hr2vLYW25JvxHs5zzsLTo=
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
github.com/PuerkitoBio/goquery v1.7.1 h1:oE+T06D+1T7LNrn91B4aERsRIeCLJ/oPSa6xB9FPnz4=
github.com/PuerkitoBio/goquery v1.7.1/go.mod h1:XY0pP4kfraEmmV1O7Uf6XyjoslwsneBbgeDjLYuN8xY=
github.com/andybalholm/cascadia v1.2.0 h1:vuRCkM5Ozh/BfmsaTm26kbjm0mIOM3yS5Ek/F5h18aE=
github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxBp0T0eFw1RUQY=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201224014010-6772e930b67b h1:iFwSg7t5GZmB/Q5TjiEAsdoLDrdJRC1RiF2WhuV29Qw=
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210716203947-853a461950ff h1:j2EK/QoxYNBsXI4R7fQkkRUk8y6wnOBI+6hgPdP/6Ds=
golang.org/x/net v0.0.0-20210716203947-853a461950ff/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

0 comments on commit 76f7807

Please sign in to comment.