From ffe2255392f4fbe6e595729d1581f56bbf2328ae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 00:06:17 +0000 Subject: [PATCH] Merge pr-131 and resolve test file conflicts Co-authored-by: xhyrom <56601352+xhyrom@users.noreply.github.com> --- tests/utils.spec.ts | 49 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/tests/utils.spec.ts b/tests/utils.spec.ts index da78242..2566512 100644 --- a/tests/utils.spec.ts +++ b/tests/utils.spec.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it, spyOn } from "bun:test"; -import { getArchitecture } from "../src/utils"; +import { getArchitecture, getAvx2 } from "../src/utils"; import * as core from "@actions/core"; describe("getArchitecture", () => { @@ -75,3 +75,50 @@ describe("getArchitecture", () => { expect(warningSpy).not.toHaveBeenCalled(); }); }); + +describe("getAvx2", () => { + it("should return false when called with os: 'windows' and arch: 'arm64'", () => { + const result = getAvx2("windows", "arm64"); + expect(result).toBe(false); + }); + + it("should return false when called with os: 'windows' and arch: 'aarch64'", () => { + const result = getAvx2("windows", "aarch64"); + expect(result).toBe(false); + }); + + it("should return false when called with os: 'windows', arch: 'arm64', and avx2: true", () => { + const result = getAvx2("windows", "arm64", true); + expect(result).toBe(false); + }); + + it("should return false when called with os: 'windows', arch: 'aarch64', and avx2: false", () => { + const result = getAvx2("windows", "aarch64", false); + expect(result).toBe(false); + }); + + it("should return the provided avx2 value (true) when specified and not on Windows ARM64", () => { + expect(getAvx2("linux", "x64", true)).toBe(true); + expect(getAvx2("darwin", "x64", true)).toBe(true); + expect(getAvx2("windows", "x64", true)).toBe(true); + }); + + it("should return the provided avx2 value (false) when specified and not on Windows ARM64", () => { + expect(getAvx2("linux", "x64", false)).toBe(false); + expect(getAvx2("darwin", "x64", false)).toBe(false); + expect(getAvx2("windows", "x64", false)).toBe(false); + }); + + it("should return true by default when avx2 is not specified and not on Windows ARM64", () => { + // x64 architecture on various platforms + expect(getAvx2("linux", "x64")).toBe(true); + expect(getAvx2("darwin", "x64")).toBe(true); + expect(getAvx2("windows", "x64")).toBe(true); + + // ARM architecture on non-Windows platforms + expect(getAvx2("linux", "arm64")).toBe(true); + expect(getAvx2("linux", "aarch64")).toBe(true); + expect(getAvx2("darwin", "arm64")).toBe(true); + expect(getAvx2("darwin", "aarch64")).toBe(true); + }); +});