fix tests

This commit is contained in:
Metazla
2024-04-02 19:57:03 +02:00
parent 60898adca5
commit 38b78f4f92
32 changed files with 923 additions and 2396 deletions
-3
View File
@@ -1,3 +0,0 @@
test('adds 1 + 2 to equal 3', () => {
expect(1 + 2).toBe(3);
});
+27
View File
@@ -0,0 +1,27 @@
import {HashComputer} from "../lib";
import {CID_ALGORITHM_NAMES} from "../lib";
import {describe, it, expect} from 'vitest';
import * as process from "process";
process.env.WORKER_URL = "./dist/worker.js";
describe('add', () => {
it('meta data compute', async () => {
let hashComputer = new HashComputer([
CID_ALGORITHM_NAMES.sha1,
CID_ALGORITHM_NAMES.sha256,
CID_ALGORITHM_NAMES.md5,
CID_ALGORITHM_NAMES.sha3_256
]);
let metadata = {};
await hashComputer.computeMissingHash('./src/tests/test.txt', metadata);
console.log(metadata);
expect(metadata).toEqual({
cid_sha1: 'baeircff3eqvxxaqqot2lt242stkdtk3gq4c2vra',
'cid_sha2-256': 'baejbeibku6ua2l6r5olnggx4pto2sii2s5jeeawgh4cbkhlbmp52gudbua',
cid_md5: 'bahkqdvibcatpcfl7ine2n625eb5ml5mzkfaa',
'cid_sha3-256': 'baelbmidner7x3dd7t2kldh6wiq4w6lsye7qrwo6uoqot2t52zkhqk56fnq'
});
});
});
+10
View File
@@ -0,0 +1,10 @@
this is a file that is just some data to be hashed
loreum ipsum dolor sit amet
consectetur adipiscing elit
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua
ut enim ad minim veniam
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat
duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur
excepteur sint occaecat cupidatat non proident
sunt in culpa qui officia deserunt mollit anim id est laborum