mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 09:20:22 +00:00
test(discord): align native approval fixture with auto mode
This commit is contained in:
@@ -9,6 +9,11 @@ import {
|
|||||||
} from "./approval-native.js";
|
} from "./approval-native.js";
|
||||||
|
|
||||||
const STORE_PATH = path.join(os.tmpdir(), "openclaw-discord-approval-native-test.json");
|
const STORE_PATH = path.join(os.tmpdir(), "openclaw-discord-approval-native-test.json");
|
||||||
|
const NATIVE_APPROVAL_CFG = {
|
||||||
|
commands: {
|
||||||
|
ownerAllowFrom: ["discord:555555555"],
|
||||||
|
},
|
||||||
|
} as const;
|
||||||
|
|
||||||
function writeStore(store: Record<string, unknown>) {
|
function writeStore(store: Record<string, unknown>) {
|
||||||
fs.writeFileSync(STORE_PATH, `${JSON.stringify(store, null, 2)}\n`, "utf8");
|
fs.writeFileSync(STORE_PATH, `${JSON.stringify(store, null, 2)}\n`, "utf8");
|
||||||
@@ -45,7 +50,7 @@ describe("createDiscordNativeApprovalAdapter", () => {
|
|||||||
const adapter = createDiscordNativeApprovalAdapter();
|
const adapter = createDiscordNativeApprovalAdapter();
|
||||||
|
|
||||||
const target = await adapter.native?.resolveOriginTarget?.({
|
const target = await adapter.native?.resolveOriginTarget?.({
|
||||||
cfg: {} as never,
|
cfg: NATIVE_APPROVAL_CFG as never,
|
||||||
accountId: "main",
|
accountId: "main",
|
||||||
approvalKind: "plugin",
|
approvalKind: "plugin",
|
||||||
request: {
|
request: {
|
||||||
@@ -69,7 +74,7 @@ describe("createDiscordNativeApprovalAdapter", () => {
|
|||||||
const adapter = createDiscordNativeApprovalAdapter();
|
const adapter = createDiscordNativeApprovalAdapter();
|
||||||
|
|
||||||
const target = await adapter.native?.resolveOriginTarget?.({
|
const target = await adapter.native?.resolveOriginTarget?.({
|
||||||
cfg: {} as never,
|
cfg: NATIVE_APPROVAL_CFG as never,
|
||||||
accountId: "main",
|
accountId: "main",
|
||||||
approvalKind: "plugin",
|
approvalKind: "plugin",
|
||||||
request: {
|
request: {
|
||||||
@@ -104,7 +109,10 @@ describe("createDiscordNativeApprovalAdapter", () => {
|
|||||||
|
|
||||||
const adapter = createDiscordNativeApprovalAdapter();
|
const adapter = createDiscordNativeApprovalAdapter();
|
||||||
const target = await adapter.native?.resolveOriginTarget?.({
|
const target = await adapter.native?.resolveOriginTarget?.({
|
||||||
cfg: { session: { store: STORE_PATH } } as never,
|
cfg: {
|
||||||
|
...NATIVE_APPROVAL_CFG,
|
||||||
|
session: { store: STORE_PATH },
|
||||||
|
} as never,
|
||||||
accountId: "main",
|
accountId: "main",
|
||||||
approvalKind: "plugin",
|
approvalKind: "plugin",
|
||||||
request: {
|
request: {
|
||||||
@@ -129,7 +137,7 @@ describe("createDiscordNativeApprovalAdapter", () => {
|
|||||||
const adapter = createDiscordNativeApprovalAdapter();
|
const adapter = createDiscordNativeApprovalAdapter();
|
||||||
|
|
||||||
const target = await adapter.native?.resolveOriginTarget?.({
|
const target = await adapter.native?.resolveOriginTarget?.({
|
||||||
cfg: {} as never,
|
cfg: NATIVE_APPROVAL_CFG as never,
|
||||||
accountId: "main",
|
accountId: "main",
|
||||||
approvalKind: "plugin",
|
approvalKind: "plugin",
|
||||||
request: {
|
request: {
|
||||||
@@ -154,7 +162,7 @@ describe("createDiscordNativeApprovalAdapter", () => {
|
|||||||
const adapter = createDiscordNativeApprovalAdapter();
|
const adapter = createDiscordNativeApprovalAdapter();
|
||||||
|
|
||||||
const target = await adapter.native?.resolveOriginTarget?.({
|
const target = await adapter.native?.resolveOriginTarget?.({
|
||||||
cfg: {} as never,
|
cfg: NATIVE_APPROVAL_CFG as never,
|
||||||
accountId: "main",
|
accountId: "main",
|
||||||
approvalKind: "plugin",
|
approvalKind: "plugin",
|
||||||
request: {
|
request: {
|
||||||
@@ -176,7 +184,7 @@ describe("createDiscordNativeApprovalAdapter", () => {
|
|||||||
const adapter = createDiscordNativeApprovalAdapter();
|
const adapter = createDiscordNativeApprovalAdapter();
|
||||||
|
|
||||||
const target = await adapter.native?.resolveOriginTarget?.({
|
const target = await adapter.native?.resolveOriginTarget?.({
|
||||||
cfg: {} as never,
|
cfg: NATIVE_APPROVAL_CFG as never,
|
||||||
accountId: "main",
|
accountId: "main",
|
||||||
approvalKind: "plugin",
|
approvalKind: "plugin",
|
||||||
request: {
|
request: {
|
||||||
|
|||||||
Reference in New Issue
Block a user