const { test } = require("node:test"); const assert = require("node:assert"); const { verifyExecutionKey } = require("../src/lib/executionKeys"); const CONFIG = JSON.stringify({ "lineworks-form-sync": "exec-key-abc" }); test("returns true when the provided key matches the configured key for that 連携キー", () => { assert.strictEqual(verifyExecutionKey({ key: "lineworks-form-sync", providedKey: "exec-key-abc", configJson: CONFIG }), true); }); test("returns false when the provided key does not match", () => { assert.strictEqual(verifyExecutionKey({ key: "lineworks-form-sync", providedKey: "wrong", configJson: CONFIG }), false); }); test("returns false when the 連携キー is not present in the config", () => { assert.strictEqual(verifyExecutionKey({ key: "unknown-key", providedKey: "exec-key-abc", configJson: CONFIG }), false); }); test("returns false when providedKey is missing", () => { assert.strictEqual(verifyExecutionKey({ key: "lineworks-form-sync", providedKey: undefined, configJson: CONFIG }), false); });