diff --git a/__test__/utils.spec.mjs b/__test__/utils.spec.mjs index 6660e20..e0c81c8 100644 --- a/__test__/utils.spec.mjs +++ b/__test__/utils.spec.mjs @@ -135,72 +135,4 @@ test.skip("zip speed test", async (t) => { console.log(`total rough average: ${prettyBytes(roughAverage)}/s`); t.pass(); -}); - -test("zip manifest test", async (t) => { - const zipFiles = fs.readdirSync("./assets").filter((v) => v.endsWith(".zip")); - - for (const zipFile of zipFiles) { - console.log("generating manifest for " + zipFile); - const manifest = JSON.parse( - await generateManifest( - "./assets/" + zipFile, - (_, __) => {}, - (_, __) => {} - ) - ); - const files = await listFiles("./assets/" + zipFile); - - if(Object.keys(manifest).length == 0) return t.fail("manifest was empty") - - for (const [filename, data] of Object.entries(manifest)) { - let start = 0; - for (const [chunkIndex, length] of data.lengths.entries()) { - const hash = createHash("md5"); - const stream = await readFile( - "./assets/" + zipFile, - filename, - BigInt(start), - BigInt(start + length) - ); - - let streamLength = 0; - await stream.pipeTo( - new WritableStream({ - write(chunk) { - streamLength += chunk.length; - hash.update(chunk); - }, - }) - ); - - if (streamLength != length) - return t.fail( - `stream length for chunk index ${chunkIndex} was not expected: real: ${streamLength} vs expected: ${length}` - ); - - const digest = hash.digest("hex"); - if (data.checksums[chunkIndex] != digest) - return t.fail( - `checksums did not match for chunk index ${chunkIndex}: real: ${digest} vs expected: ${data.checksums[chunkIndex]}` - ); - - start += length; - } - } - } - - t.pass(); -}); - -test.skip("partially compress zip test", async (t) => { - const manifest = JSON.parse( - await generateManifest( - "./assets/my horror game.zip", - (_, __) => {}, - (_, __) => {} - ) - ); - - return t.pass(); -}); +}); \ No newline at end of file diff --git a/package.json b/package.json index 91ed9b2..045d170 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "build": "napi build --platform --release", "build:debug": "napi build --platform", "prepublishOnly": "napi prepublish -t npm", - "test": "ava ", + "test": "ava __test__/*", "universal": "napi universalize", "version": "napi version" },