Integration test: default announce list changed

This commit is contained in:
DC
2016-09-21 13:06:35 -07:00
parent 82c49b5fc5
commit 8e66f641ce
4 changed files with 33 additions and 5 deletions

View File

@@ -11,6 +11,7 @@ module.exports = {
screenshotCreateOrCompare,
compareDownloadFolder,
compareFiles,
compareTorrentFile,
compareTorrentFiles,
waitForLoad,
wait,
@@ -185,6 +186,13 @@ function compareTorrentFiles (t, pathActual, pathExpected) {
t.deepEqual(fieldsActual, fieldsExpected, 'torrent contents: ' + pathActual)
}
// Makes sure two torrents have the same infohash and flags
function compareTorrentFile (t, pathActual, fieldsExpected) {
const bufActual = fs.readFileSync(pathActual)
const fieldsActual = extractImportantFields(parseTorrent(bufActual))
t.deepEqual(fieldsActual, fieldsExpected, 'torrent contents: ' + pathActual)
}
function extractImportantFields (parsedTorrent) {
const { infoHash, name, announce, urlList, comment } = parsedTorrent
const priv = parsedTorrent.private // private is a reserved word in JS