Skip to content

Commit 2b72ae0

Browse files
committed
refactor: [#1283] move test helpers to main test mod in package
1 parent 3b5cf86 commit 2b72ae0

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

packages/axum-http-tracker-server/src/lib.rs

+18-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ use serde::{Deserialize, Serialize};
307307

308308
pub mod container;
309309
pub mod server;
310-
pub mod test_helpers;
311310
pub mod v1;
312311

313312
pub const HTTP_TRACKER_LOG_TARGET: &str = "HTTP TRACKER";
@@ -318,3 +317,21 @@ pub enum Version {
318317
/// The `v1` version of the HTTP tracker.
319318
V1,
320319
}
320+
321+
#[cfg(test)]
322+
pub(crate) mod tests {
323+
324+
pub(crate) mod helpers {
325+
use bittorrent_primitives::info_hash::InfoHash;
326+
327+
/// # Panics
328+
///
329+
/// Will panic if the string representation of the info hash is not a valid info hash.
330+
#[must_use]
331+
pub fn sample_info_hash() -> InfoHash {
332+
"3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0" // DevSkim: ignore DS173237
333+
.parse::<InfoHash>()
334+
.expect("String should be a valid info hash")
335+
}
336+
}
337+
}

packages/axum-http-tracker-server/src/test_helpers.rs

-16
This file was deleted.

packages/axum-http-tracker-server/src/v1/handlers/announce.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ mod tests {
199199
use torrust_tracker_configuration::{Configuration, Core};
200200
use torrust_tracker_test_helpers::configuration;
201201

202-
use crate::test_helpers::tests::sample_info_hash;
202+
use crate::tests::helpers::sample_info_hash;
203203

204204
struct CoreTrackerServices {
205205
pub core_config: Arc<Core>,

0 commit comments

Comments
 (0)