diff --git a/module/torrent/torrent_test.go b/module/torrent/torrent_test.go index 1aef0c6..33d13b6 100644 --- a/module/torrent/torrent_test.go +++ b/module/torrent/torrent_test.go @@ -71,6 +71,34 @@ func TestRepackTorrent(t *testing.T) { t.Log(torrent) assert.Equal(t, torrent.Comment, comment) assert.Equal(t, torrent.Info.Source, infoSource) + assert.Equal(t, torrent.AnnounceList, TRACKER_LIST) +} + +func TestTorrentFileList(t *testing.T) { + torrentFilePath := testTorrentFolder + + torrent, err := NewBitTorrentFilePath(torrentFilePath) + if err != nil { + t.Error(err) + return + } + + fileList := torrent.GetFileList() + t.Log(fileList) + assert.Equal(t, len(fileList), 2) + assert.Equal(t, fileList[0].Path, []string{"cxk", "cxk.jpg"}) + + torrentFilePath = testTorrent + torrent, err = NewBitTorrentFilePath(torrentFilePath) + if err != nil { + t.Error(err) + return + } + + fileList = torrent.GetFileList() + t.Log(fileList) + assert.Equal(t, len(fileList), 1) + assert.Equal(t, fileList[0].Path, []string{"lenna.jpg"}) } func TestTorrentFileList(t *testing.T) {