mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 20:28:29 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { resolveTwitchToken, type TwitchTokenSource } from "./token.js";
|
||||
import type { MoltbotConfig } from "clawdbot/plugin-sdk";
|
||||
import type { OpenClawConfig } from "openclaw/plugin-sdk";
|
||||
|
||||
describe("token", () => {
|
||||
// Multi-account config for testing non-default accounts
|
||||
@@ -29,7 +29,7 @@ describe("token", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
} as unknown as MoltbotConfig;
|
||||
} as unknown as OpenClawConfig;
|
||||
|
||||
// Simplified single-account config
|
||||
const mockSimplifiedConfig = {
|
||||
@@ -39,7 +39,7 @@ describe("token", () => {
|
||||
accessToken: "oauth:config-token",
|
||||
},
|
||||
},
|
||||
} as unknown as MoltbotConfig;
|
||||
} as unknown as OpenClawConfig;
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
@@ -47,7 +47,7 @@ describe("token", () => {
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
delete process.env.CLAWDBOT_TWITCH_ACCESS_TOKEN;
|
||||
delete process.env.OPENCLAW_TWITCH_ACCESS_TOKEN;
|
||||
});
|
||||
|
||||
describe("resolveTwitchToken", () => {
|
||||
@@ -66,7 +66,7 @@ describe("token", () => {
|
||||
});
|
||||
|
||||
it("should prioritize config token over env var (simplified config)", () => {
|
||||
process.env.CLAWDBOT_TWITCH_ACCESS_TOKEN = "oauth:env-token";
|
||||
process.env.OPENCLAW_TWITCH_ACCESS_TOKEN = "oauth:env-token";
|
||||
|
||||
const result = resolveTwitchToken(mockSimplifiedConfig, { accountId: "default" });
|
||||
|
||||
@@ -76,7 +76,7 @@ describe("token", () => {
|
||||
});
|
||||
|
||||
it("should use env var when config token is empty (simplified config)", () => {
|
||||
process.env.CLAWDBOT_TWITCH_ACCESS_TOKEN = "oauth:env-token";
|
||||
process.env.OPENCLAW_TWITCH_ACCESS_TOKEN = "oauth:env-token";
|
||||
|
||||
const configWithEmptyToken = {
|
||||
channels: {
|
||||
@@ -85,7 +85,7 @@ describe("token", () => {
|
||||
accessToken: "",
|
||||
},
|
||||
},
|
||||
} as unknown as MoltbotConfig;
|
||||
} as unknown as OpenClawConfig;
|
||||
|
||||
const result = resolveTwitchToken(configWithEmptyToken, { accountId: "default" });
|
||||
|
||||
@@ -101,7 +101,7 @@ describe("token", () => {
|
||||
accessToken: "",
|
||||
},
|
||||
},
|
||||
} as unknown as MoltbotConfig;
|
||||
} as unknown as OpenClawConfig;
|
||||
|
||||
const result = resolveTwitchToken(configWithoutToken, { accountId: "default" });
|
||||
|
||||
@@ -110,7 +110,7 @@ describe("token", () => {
|
||||
});
|
||||
|
||||
it("should not use env var for non-default accounts (multi-account)", () => {
|
||||
process.env.CLAWDBOT_TWITCH_ACCESS_TOKEN = "oauth:env-token";
|
||||
process.env.OPENCLAW_TWITCH_ACCESS_TOKEN = "oauth:env-token";
|
||||
|
||||
const configWithoutToken = {
|
||||
channels: {
|
||||
@@ -123,7 +123,7 @@ describe("token", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
} as unknown as MoltbotConfig;
|
||||
} as unknown as OpenClawConfig;
|
||||
|
||||
const result = resolveTwitchToken(configWithoutToken, { accountId: "secondary" });
|
||||
|
||||
@@ -139,7 +139,7 @@ describe("token", () => {
|
||||
accounts: {},
|
||||
},
|
||||
},
|
||||
} as unknown as MoltbotConfig;
|
||||
} as unknown as OpenClawConfig;
|
||||
|
||||
const result = resolveTwitchToken(configWithoutAccount, { accountId: "nonexistent" });
|
||||
|
||||
@@ -150,7 +150,7 @@ describe("token", () => {
|
||||
it("should handle missing Twitch config section", () => {
|
||||
const configWithoutSection = {
|
||||
channels: {},
|
||||
} as unknown as MoltbotConfig;
|
||||
} as unknown as OpenClawConfig;
|
||||
|
||||
const result = resolveTwitchToken(configWithoutSection, { accountId: "default" });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user