mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 05:47:28 +00:00
zalouser: update account-scope test for scoped store API
This commit is contained in:
committed by
Peter Steinberger
parent
6aa20e91d9
commit
f4c3e483fe
@@ -13,8 +13,22 @@ vi.mock("./send.js", () => ({
|
|||||||
describe("zalouser monitor pairing account scoping", () => {
|
describe("zalouser monitor pairing account scoping", () => {
|
||||||
it("scopes DM pairing-store reads and pairing requests to accountId", async () => {
|
it("scopes DM pairing-store reads and pairing requests to accountId", async () => {
|
||||||
const readAllowFromStore = vi.fn(
|
const readAllowFromStore = vi.fn(
|
||||||
async (_channel: string, _env?: NodeJS.ProcessEnv, accountId?: string) =>
|
async (
|
||||||
accountId === "beta" ? [] : ["attacker"],
|
channelOrParams:
|
||||||
|
| string
|
||||||
|
| {
|
||||||
|
channel?: string;
|
||||||
|
accountId?: string;
|
||||||
|
},
|
||||||
|
_env?: NodeJS.ProcessEnv,
|
||||||
|
accountId?: string,
|
||||||
|
) => {
|
||||||
|
const scopedAccountId =
|
||||||
|
typeof channelOrParams === "object" && channelOrParams !== null
|
||||||
|
? channelOrParams.accountId
|
||||||
|
: accountId;
|
||||||
|
return scopedAccountId === "beta" ? [] : ["attacker"];
|
||||||
|
},
|
||||||
);
|
);
|
||||||
const upsertPairingRequest = vi.fn(async () => ({ code: "PAIRME88", created: true }));
|
const upsertPairingRequest = vi.fn(async () => ({ code: "PAIRME88", created: true }));
|
||||||
|
|
||||||
@@ -86,7 +100,12 @@ describe("zalouser monitor pairing account scoping", () => {
|
|||||||
runtime,
|
runtime,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(readAllowFromStore).toHaveBeenCalledWith("zalouser", undefined, "beta");
|
expect(readAllowFromStore).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
channel: "zalouser",
|
||||||
|
accountId: "beta",
|
||||||
|
}),
|
||||||
|
);
|
||||||
expect(upsertPairingRequest).toHaveBeenCalledWith(
|
expect(upsertPairingRequest).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
channel: "zalouser",
|
channel: "zalouser",
|
||||||
|
|||||||
Reference in New Issue
Block a user