Fix some tests
This commit is contained in:
parent
4165fe6776
commit
873ff8e6ea
|
@ -29,7 +29,7 @@
|
|||
"uvu": "^0.5.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": " >=14.13.1 || >=16.0.0"
|
||||
"node": " >=14.19.3 || >=16.15.0 || >=18.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@captn3m0/electron-fingerprints": {
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
},
|
||||
"homepage": "https://github.com/captn3m0/which-electron#readme",
|
||||
"dependencies": {
|
||||
"@captn3m0/electron-fingerprints": "*",
|
||||
"7zip-bin": "^5.1.1",
|
||||
"disassembler": "^0.3.0-beta",
|
||||
"@captn3m0/electron-fingerprints": "*",
|
||||
"elfinfo": "^0.3.0-beta",
|
||||
"hasha": "^5.2.2",
|
||||
"is-valid-http-url": "^1.0.3",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import DB from "electron-fingerprints";
|
||||
import DB from "@captn3m0/electron-fingerprints";
|
||||
import fs from "fs";
|
||||
import hasha from "hasha";
|
||||
import crypto from "crypto";
|
||||
|
@ -26,7 +26,7 @@ export function guessFromHashes(os, arch, hashList) {
|
|||
);
|
||||
// Set it to the starting list of versions.
|
||||
let possibleVersions = allVersions;
|
||||
for (i in hashList) {
|
||||
for (let i in hashList) {
|
||||
let hash = hashList[i];
|
||||
let versions = lookupTable[hash];
|
||||
if (versions) {
|
||||
|
|
|
@ -43,7 +43,7 @@ test("it should find the version file", () => {
|
|||
);
|
||||
});
|
||||
|
||||
test("it should find fingerprinteable files", () => {
|
||||
test("it should find fingerprintable files", () => {
|
||||
assert.equal(
|
||||
[
|
||||
"Arizona v.1.0.0/Arizona.exe",
|
||||
|
@ -93,7 +93,7 @@ test("it should find fingerprinteable files", () => {
|
|||
);
|
||||
|
||||
assert.equal(
|
||||
[
|
||||
new Set([
|
||||
"resources/app.asar",
|
||||
"swiftshader/libvk_swiftshader.so",
|
||||
"libGLESv2.so",
|
||||
|
@ -104,8 +104,8 @@ test("it should find fingerprinteable files", () => {
|
|||
"swiftshader/libEGL.so",
|
||||
"libEGL.so",
|
||||
"natives_blob.bin",
|
||||
],
|
||||
finder.fingerprintable(getEntries("Rambox-0.7.7-linux-x64.zip"))
|
||||
]),
|
||||
new Set(finder.fingerprintable(getEntries("Rambox-0.7.7-linux-x64.zip")))
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
|
@ -125,7 +125,7 @@ test("it should find fingerprinteable files", () => {
|
|||
);
|
||||
|
||||
assert.equal(
|
||||
[
|
||||
new Set([
|
||||
"Hyper.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib",
|
||||
"Hyper.app/Contents/Resources/app.asar",
|
||||
"Hyper.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib",
|
||||
|
@ -202,12 +202,12 @@ test("it should find fingerprinteable files", () => {
|
|||
"Hyper.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSText+RACSignalSupport.h",
|
||||
"Hyper.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/RACUnit.h",
|
||||
"Hyper.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/Headers/NSFileHandle+RACSupport.h",
|
||||
],
|
||||
finder.fingerprintable(getEntries("Hyper-3.0.2-mac.zip"))
|
||||
]),
|
||||
new Set(finder.fingerprintable(getEntries("Hyper-3.0.2-mac.zip")))
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
[
|
||||
new Set([
|
||||
"Notable.exe",
|
||||
"libGLESv2.dll",
|
||||
"resources/app.asar",
|
||||
|
@ -219,12 +219,12 @@ test("it should find fingerprinteable files", () => {
|
|||
"snapshot_blob.bin",
|
||||
"libEGL.dll",
|
||||
"natives_blob.bin",
|
||||
],
|
||||
finder.fingerprintable(getEntries("Notable-1.8.4-win.zip"))
|
||||
]),
|
||||
new Set(finder.fingerprintable(getEntries("Notable-1.8.4-win.zip")))
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
[
|
||||
new Set([
|
||||
"release-builds/encrypt0r-darwin-x64/encrypt0r.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib",
|
||||
"release-builds/encrypt0r-darwin-x64/encrypt0r.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libswiftshader_libGLESv2.dylib",
|
||||
"release-builds/encrypt0r-darwin-x64/encrypt0r.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib",
|
||||
|
@ -246,8 +246,8 @@ test("it should find fingerprinteable files", () => {
|
|||
"release-builds/encrypt0r-darwin-x64/encrypt0r.app/Contents/Frameworks/Electron Framework.framework/Libraries/libvk_swiftshader.dylib",
|
||||
"release-builds/encrypt0r-darwin-x64/encrypt0r.app/Contents/Frameworks/Electron Framework.framework/Libraries/libswiftshader_libEGL.dylib",
|
||||
"release-builds/encrypt0r-darwin-x64/encrypt0r.app/Contents/Frameworks/Electron Framework.framework/Resources/v8_context_snapshot.x86_64.bin",
|
||||
],
|
||||
finder.fingerprintable(getEntries("encrypt0r-mac.zip"))
|
||||
]),
|
||||
new Set(finder.fingerprintable(getEntries("encrypt0r-mac.zip")))
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -3,26 +3,26 @@ import * as assert from "uvu/assert";
|
|||
import { guessFromHashes, getHashes } from "../src/fingerprint.js";
|
||||
|
||||
test("it should work with a single fingerprint", () => {
|
||||
guess = guessFromHashes("win32", "x64", [
|
||||
let guess = guessFromHashes("win32", "x64", [
|
||||
"cbdbe566564c323032c02c1a838358a314af63b4",
|
||||
]);
|
||||
assert.equal(guess, ["v0.24.0"]);
|
||||
});
|
||||
|
||||
test("it should work with a ffmpeg hash", () => {
|
||||
guess = guessFromHashes("win32", "x64", [
|
||||
let guess = guessFromHashes("win32", "x64", [
|
||||
"baf786083f482c1f035e50e105b5f7475af1e00b",
|
||||
]);
|
||||
assert.equal(guess, ["v1.4.3", "v1.4.4", "v1.4.5"]);
|
||||
});
|
||||
|
||||
test("it should work with multiple fingerprints", () => {
|
||||
hashes = [
|
||||
let hashes = [
|
||||
"45c1db70ce3062aae85069629519e61bac6cf5d2",
|
||||
"944bff8704d4b152279fbdacb911b516502be056",
|
||||
"3c592e2cdadbb0bcd8f522071a63da5febe9aa37",
|
||||
];
|
||||
guess = guessFromHashes("darwin", "x64", hashes);
|
||||
let guess = guessFromHashes("darwin", "x64", hashes);
|
||||
assert.equal(guess, ["v1.7.6"]);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue