mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 16:40:26 +00:00
test: merge allowlist resolution coverage
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
|||||||
formatNormalizedAllowFromEntries,
|
formatNormalizedAllowFromEntries,
|
||||||
isAllowedParsedChatSender,
|
isAllowedParsedChatSender,
|
||||||
isNormalizedSenderAllowed,
|
isNormalizedSenderAllowed,
|
||||||
|
mapAllowlistResolutionInputs,
|
||||||
} from "./allow-from.js";
|
} from "./allow-from.js";
|
||||||
|
|
||||||
function parseAllowTarget(
|
function parseAllowTarget(
|
||||||
@@ -144,3 +145,19 @@ describe("formatNormalizedAllowFromEntries", () => {
|
|||||||
expect(formatNormalizedAllowFromEntries(input)).toEqual(expected);
|
expect(formatNormalizedAllowFromEntries(input)).toEqual(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("mapAllowlistResolutionInputs", () => {
|
||||||
|
it("maps inputs sequentially and preserves order", async () => {
|
||||||
|
const visited: string[] = [];
|
||||||
|
const result = await mapAllowlistResolutionInputs({
|
||||||
|
inputs: ["one", "two", "three"],
|
||||||
|
mapInput: async (input) => {
|
||||||
|
visited.push(input);
|
||||||
|
return input.toUpperCase();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(visited).toEqual(["one", "two", "three"]);
|
||||||
|
expect(result).toEqual(["ONE", "TWO", "THREE"]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
import { describe, expect, it } from "vitest";
|
|
||||||
import { mapAllowlistResolutionInputs } from "./allow-from.js";
|
|
||||||
|
|
||||||
describe("mapAllowlistResolutionInputs", () => {
|
|
||||||
it("maps inputs sequentially and preserves order", async () => {
|
|
||||||
const visited: string[] = [];
|
|
||||||
const result = await mapAllowlistResolutionInputs({
|
|
||||||
inputs: ["one", "two", "three"],
|
|
||||||
mapInput: async (input) => {
|
|
||||||
visited.push(input);
|
|
||||||
return input.toUpperCase();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(visited).toEqual(["one", "two", "three"]);
|
|
||||||
expect(result).toEqual(["ONE", "TWO", "THREE"]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user