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