feat(agents): add versioned offline driver packages
This commit is contained in:
1 parent
8d68a527a0
commit
79cd12d13a
29 files changed
+1372
-162
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { isOfflineDriverPackage, webDriverImportAccept } from "./driverImportSelection";
|
||||
|
||||
describe("driver import selection", () => {
|
||||
it("recognizes ZIP paths and uploaded files case-insensitively", () => {
|
||||
expect(isOfflineDriverPackage("C:\\Downloads\\dbx-agent-h2-0.2.5.ZIP")).toBe(true);
|
||||
expect(isOfflineDriverPackage({ name: "dbx-agent-kingbase-0.1.34-macos-aarch64.zip" })).toBe(true);
|
||||
expect(isOfflineDriverPackage({ name: "dbx-agent-h2-0.2.5.jar" })).toBe(false);
|
||||
});
|
||||
|
||||
it("allows ZIP alongside the platform raw artifact", () => {
|
||||
expect(webDriverImportAccept(true, false)).toBe(".zip,.jar");
|
||||
expect(webDriverImportAccept(false, true)).toBe(".zip,.exe");
|
||||
expect(webDriverImportAccept(false, false)).toBe("");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
export type DriverImportSelection = string | { name: string };
|
||||
|
||||
export function isOfflineDriverPackage(selection: DriverImportSelection): boolean {
|
||||
const name = typeof selection === "string" ? selection : selection.name;
|
||||
return name.toLowerCase().endsWith(".zip");
|
||||
}
|
||||
|
||||
export function webDriverImportAccept(requiresJavaRuntime: boolean, isWindows: boolean): string {
|
||||
if (requiresJavaRuntime) return ".zip,.jar";
|
||||
return isWindows ? ".zip,.exe" : "";
|
||||
}
|
||||
Reference in new issue
Block a user