Skip to content

Commit

Permalink
Try to fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jurplel committed Nov 7, 2024
1 parent f46592e commit 422aced
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions action/tests/locateQtArchDir.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { locateQtArchDir } from "../src/helpers";
import { locateQtArchDir, nativePath } from "../src/helpers";
import * as fs from "fs";
import * as path from "path";
import "jest";
Expand Down Expand Up @@ -43,10 +43,26 @@ describe("locateQtArchDir integration tests", () => {
createDummyQMakeFile(fullPath);
});

const result = locateQtArchDir(tempDir);
const result = nativePath(locateQtArchDir(tempDir));
expect(result).toBe(path.join(tempDir, "6.4.2/gcc_64"));
});

it("Windows-specific folder", () => {
const dirsToCreate = [
"6.4.3/msvc2022_64/bin",
];

dirsToCreate.forEach((dir) => {
const fullPath = path.join(tempDir, dir);
fs.mkdirSync(fullPath, { recursive: true });
// create dummy qmake file
createDummyQMakeFile(fullPath);
});

const result = nativePath(locateQtArchDir(tempDir));
expect(result).toBe(path.join(tempDir, "6.4.3/msvc2022_64"));
});

it("should prioritize mobile installation if both mobile and desktop installations are present", () => {
const dirsToCreate = ["6.4.2/android_arm64_v8a/bin", "6.4.2/gcc_64/bin"];

Expand All @@ -56,7 +72,7 @@ describe("locateQtArchDir integration tests", () => {
createDummyQMakeFile(fullPath);
});

const result = locateQtArchDir(tempDir);
const result = nativePath(locateQtArchDir(tempDir));
expect(result).toBe(path.join(tempDir, "6.4.2/android_arm64_v8a"));
});

Expand All @@ -69,7 +85,7 @@ describe("locateQtArchDir integration tests", () => {
createDummyQMakeFile(fullPath);
});

const result = locateQtArchDir(tempDir);
const result = nativePath(locateQtArchDir(tempDir));
expect(result).toBe(path.join(tempDir, "6.4.2/wasm_32"));
});

Expand All @@ -82,12 +98,12 @@ describe("locateQtArchDir integration tests", () => {
createDummyQMakeFile(fullPath);
});

const result = locateQtArchDir(tempDir);
const result = nativePath(locateQtArchDir(tempDir));
expect(result).toBe(path.join(tempDir, "6.4.2/msvc2019_arm64"));
});

it("should throw an error if no valid Qt installation directories are found", () => {
expect(() => locateQtArchDir(tempDir)).toThrow(
expect(() => nativePath(locateQtArchDir(tempDir))).toThrow(
`Failed to locate a Qt installation directory in ${tempDir}`
);
});
Expand All @@ -105,7 +121,7 @@ describe("locateQtArchDir integration tests", () => {
createDummyQMakeFile(fullPath);
});

const result = locateQtArchDir(tempDir);
const result = nativePath(locateQtArchDir(tempDir));
expect(result).toBe(path.join(tempDir, "6.4.2/android_arm64_v8a"));
});
});

0 comments on commit 422aced

Please sign in to comment.