mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-09 17:03:09 +00:00
Updates magnet link tests
This commit is contained in:
parent
8ac8f941c4
commit
03ff25bbb1
@ -7,7 +7,6 @@ import pkg/questionable
|
||||
import pkg/questionable/results
|
||||
|
||||
import ../errors
|
||||
import ../codextypes
|
||||
import ./manifest/manifest
|
||||
|
||||
type
|
||||
|
||||
@ -11,15 +11,14 @@ import ../examples
|
||||
import pkg/codex/bittorrent/magnetlink
|
||||
|
||||
suite "bittorrent magnet links":
|
||||
test "tt":
|
||||
let magnetLinkStr = "magnet:?xt=urn:btih:1902d602db8c350f4f6d809ed01eff32f030da95"
|
||||
test "creates correct magnet link object from provided string":
|
||||
let infoHash = "1902d602db8c350f4f6d809ed01eff32f030da95".toUpperAscii
|
||||
let magnetLinkStr = fmt"magnet:?xt=urn:btih:{infoHash}"
|
||||
let magnetLink = newMagnetLink(magnetLinkStr).tryGet()
|
||||
check $magnetLink == magnetLinkStr
|
||||
test "correctly parses magnet link version 1":
|
||||
let multiHash = MultiHash.example(Sha1HashCodec)
|
||||
let hash = multiHash.data.buffer[multiHash.dpos .. ^1]
|
||||
# echo byteutils.toHex(hash)
|
||||
# echo multiHash.hex
|
||||
let magnetLinkStr =
|
||||
fmt"magnet:?xt=urn:btih:{byteutils.toHex(hash).toUpperAscii}&dn=example.txt&tr=udp://tracker.example.com/announce&x.pe=31.205.250.200:8080"
|
||||
let magnetLink = newMagnetLink(magnetLinkStr).tryGet()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user