diff --git a/packages/tracker-client/src/http/mod.rs b/packages/tracker-client/src/http/mod.rs index 15723c1b..d8f8242e 100644 --- a/packages/tracker-client/src/http/mod.rs +++ b/packages/tracker-client/src/http/mod.rs @@ -24,3 +24,19 @@ impl InfoHash { self.0 } } + +#[cfg(test)] +mod tests { + use crate::http::percent_encode_byte_array; + + #[test] + fn it_should_encode_a_20_byte_array() { + assert_eq!( + percent_encode_byte_array(&[ + 0x3b, 0x24, 0x55, 0x04, 0xcf, 0x5f, 0x11, 0xbb, 0xdb, 0xe1, 0x20, 0x1c, 0xea, 0x6a, 0x6b, 0xf4, 0x5a, 0xee, 0x1b, + 0xc0, + ]), + "%3B%24U%04%CF%5F%11%BB%DB%E1%20%1C%EAjk%F4Z%EE%1B%C0" + ); + } +}