openai/codex-action
Publicmirrored from https://github.com/openai/codex-actionAvailable
test/runCodexExec.test.js
23lines · modecode
| 1 | const { describe, it } = require("node:test"); |
| 2 | const assert = require("node:assert/strict"); |
| 3 | const os = require("node:os"); |
| 4 | const path = require("node:path"); |
| 5 | |
| 6 | const { getCodexExecTempRoot } = require("../dist/main.js"); |
| 7 | |
| 8 | describe("getCodexExecTempRoot", () => { |
| 9 | it("prefers RUNNER_TEMP over os.tmpdir()", () => { |
| 10 | const originalRunnerTemp = process.env.RUNNER_TEMP; |
| 11 | process.env.RUNNER_TEMP = path.join(os.tmpdir(), "runner-temp"); |
| 12 | |
| 13 | try { |
| 14 | assert.equal(getCodexExecTempRoot(), process.env.RUNNER_TEMP); |
| 15 | } finally { |
| 16 | if (originalRunnerTemp == null) { |
| 17 | delete process.env.RUNNER_TEMP; |
| 18 | } else { |
| 19 | process.env.RUNNER_TEMP = originalRunnerTemp; |
| 20 | } |
| 21 | } |
| 22 | }); |
| 23 | }); |
| 24 | |