|
1 | 1 | import fixtures from 'webtorrent-fixtures' |
2 | 2 | import parseTorrent from 'parse-torrent' |
3 | 3 | import path from 'path' |
4 | | -import sha1 from 'simple-sha1' |
| 4 | +import { sha1 } from 'uint8-util' |
5 | 5 | import test from 'tape' |
6 | 6 | import createTorrent from '../index.js' |
7 | 7 |
|
@@ -54,7 +54,9 @@ test('create single file torrent', t => { |
54 | 54 | 'c698de9b0dad92980906c026d8c1408fa08fe4ec' |
55 | 55 | ]) |
56 | 56 |
|
57 | | - t.equals(sha1.sync(parsedTorrent.infoBuffer), 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36') |
| 57 | + sha1(parsedTorrent.infoBuffer, hash => { |
| 58 | + t.equals(hash, 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36') |
| 59 | + }) |
58 | 60 | }) |
59 | 61 | }) |
60 | 62 |
|
@@ -112,7 +114,9 @@ test('create multi file torrent', t => { |
112 | 114 | t.deepEquals(parsedTorrent.pieces, [ |
113 | 115 | '1f74648e50a6a6708ec54ab327a163d5536b7ced' |
114 | 116 | ]) |
115 | | - t.equals(sha1.sync(parsedTorrent.infoBuffer), '80562f38656b385ea78959010e51a2cc9db41ea0') |
| 117 | + sha1(parsedTorrent.infoBuffer, hash => { |
| 118 | + t.equals(hash, '80562f38656b385ea78959010e51a2cc9db41ea0') |
| 119 | + }) |
116 | 120 | }) |
117 | 121 | }) |
118 | 122 |
|
@@ -165,8 +169,9 @@ test('create multi file torrent with nested directories', t => { |
165 | 169 | t.deepEquals(parsedTorrent.pieces, [ |
166 | 170 | '47972f2befaee58b6f3860cd39bd56cb33a488f0' |
167 | 171 | ]) |
168 | | - |
169 | | - t.equals(sha1.sync(parsedTorrent.infoBuffer), '427887e9c03e123f9c8458b1947090edf1c75baa') |
| 172 | + sha1(parsedTorrent.infoBuffer, hash => { |
| 173 | + t.equals(hash, '427887e9c03e123f9c8458b1947090edf1c75baa') |
| 174 | + }) |
170 | 175 | }) |
171 | 176 | }) |
172 | 177 |
|
@@ -225,6 +230,8 @@ test('create multi file torrent with array of paths', t => { |
225 | 230 | t.deepEquals(parsedTorrent.pieces, [ |
226 | 231 | '1c4e1ba6da4d771ff82025d7cf76e8c368c6c3dd' |
227 | 232 | ]) |
228 | | - t.equals(sha1.sync(parsedTorrent.infoBuffer), 'df25a2959378892f6ddaf4a2d7e75174e09878bb') |
| 233 | + sha1(parsedTorrent.infoBuffer, hash => { |
| 234 | + t.equals(hash, 'df25a2959378892f6ddaf4a2d7e75174e09878bb') |
| 235 | + }) |
229 | 236 | }) |
230 | 237 | }) |
0 commit comments