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