1 | const assert = require('assert')
|
2 |
|
3 | const {
|
4 | DEFAULT_ALGORITHM,
|
5 | SHA1,
|
6 | checksum,
|
7 | checksumFilePath,
|
8 | hashFromFileContent,
|
9 | } = require('./checksum')
|
10 |
|
11 |
|
12 | assert(checksum('', SHA1) === 'da39a3ee5e6b4b0d3255bfef95601890afd80709')
|
13 | assert(checksum('42', SHA1) === '92cfceb39d57d914ed8b14d0e37643de0797ae56')
|
14 | assert(checksum('abc', SHA1) === 'a9993e364706816aba3e25717850c26c9cd0d89d')
|
15 |
|
16 | assert(DEFAULT_ALGORITHM === SHA1)
|
17 | assert(checksum('foo') === checksum('foo', SHA1))
|
18 |
|
19 | assert(hashFromFileContent('1234 x.txt') === '1234')
|
20 | assert(hashFromFileContent(' 1234 x.txt ') === '1234')
|
21 |
|
22 | assert(checksumFilePath('./test.txt') === '.test.txt.sha')
|
23 | assert(checksumFilePath('../test.txt') === '../.test.txt.sha')
|
24 |
|
25 |
|
26 |
|