Skip to content

Commit 2ac68f6

Browse files
committed
refactor: [torrust#1203] move test
1 parent 94673d6 commit 2ac68f6

File tree

2 files changed

+26
-17
lines changed

2 files changed

+26
-17
lines changed

src/core/mod.rs

-17
Original file line numberDiff line numberDiff line change
@@ -874,23 +874,6 @@ mod tests {
874874
}
875875
}
876876

877-
#[tokio::test]
878-
async fn should_collect_torrent_metrics() {
879-
let tracker = public_tracker();
880-
881-
let torrents_metrics = tracker.in_memory_torrent_repository.get_torrents_metrics();
882-
883-
assert_eq!(
884-
torrents_metrics,
885-
TorrentsMetrics {
886-
complete: 0,
887-
downloaded: 0,
888-
incomplete: 0,
889-
torrents: 0
890-
}
891-
);
892-
}
893-
894877
#[tokio::test]
895878
async fn it_should_return_the_peers_for_a_given_torrent() {
896879
let tracker = public_tracker();

src/core/torrent/repository/in_memory.rs

+26
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,29 @@ impl InMemoryTorrentRepository {
101101
self.torrents.import_persistent(persistent_torrents);
102102
}
103103
}
104+
105+
#[cfg(test)]
106+
mod tests {
107+
use std::sync::Arc;
108+
109+
use torrust_tracker_primitives::torrent_metrics::TorrentsMetrics;
110+
111+
use crate::core::torrent::repository::in_memory::InMemoryTorrentRepository;
112+
113+
#[tokio::test]
114+
async fn should_collect_torrent_metrics() {
115+
let in_memory_torrent_repository = Arc::new(InMemoryTorrentRepository::default());
116+
117+
let torrents_metrics = in_memory_torrent_repository.get_torrents_metrics();
118+
119+
assert_eq!(
120+
torrents_metrics,
121+
TorrentsMetrics {
122+
complete: 0,
123+
downloaded: 0,
124+
incomplete: 0,
125+
torrents: 0
126+
}
127+
);
128+
}
129+
}

0 commit comments

Comments
 (0)