fix multi account id + add unit test
This commit is contained in:
parent
a2dfdb83a4
commit
022526c9d6
@ -3,8 +3,9 @@ import type { ClawdbotConfig } from "clawdbot/plugin-sdk";
|
|||||||
import { twitchPlugin } from "./plugin.js";
|
import { twitchPlugin } from "./plugin.js";
|
||||||
|
|
||||||
describe("twitchPlugin.status.buildAccountSnapshot", () => {
|
describe("twitchPlugin.status.buildAccountSnapshot", () => {
|
||||||
it("uses the resolved account ID for multi-account configs", () => {
|
it("uses the resolved account ID for multi-account configs", async () => {
|
||||||
const secondary = {
|
const secondary = {
|
||||||
|
channel: "secondary-channel",
|
||||||
username: "secondary",
|
username: "secondary",
|
||||||
accessToken: "oauth:secondary-token",
|
accessToken: "oauth:secondary-token",
|
||||||
clientId: "secondary-client",
|
clientId: "secondary-client",
|
||||||
@ -16,6 +17,7 @@ describe("twitchPlugin.status.buildAccountSnapshot", () => {
|
|||||||
twitch: {
|
twitch: {
|
||||||
accounts: {
|
accounts: {
|
||||||
default: {
|
default: {
|
||||||
|
channel: "default-channel",
|
||||||
username: "default",
|
username: "default",
|
||||||
accessToken: "oauth:default-token",
|
accessToken: "oauth:default-token",
|
||||||
clientId: "default-client",
|
clientId: "default-client",
|
||||||
@ -27,11 +29,11 @@ describe("twitchPlugin.status.buildAccountSnapshot", () => {
|
|||||||
},
|
},
|
||||||
} as ClawdbotConfig;
|
} as ClawdbotConfig;
|
||||||
|
|
||||||
const snapshot = twitchPlugin.status.buildAccountSnapshot({
|
const snapshot = await twitchPlugin.status?.buildAccountSnapshot?.({
|
||||||
account: secondary,
|
account: secondary,
|
||||||
cfg,
|
cfg,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(snapshot.accountId).toBe("secondary");
|
expect(snapshot?.accountId).toBe("secondary");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user