mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 03:30:30 +00:00
test: speed up extension suites
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import ts from "typescript";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { bundledPluginRoot } from "../../../test/helpers/bundled-plugin-paths.js";
|
||||
import { loadRuntimeApiExportTypesViaJiti } from "../../../test/helpers/plugins/jiti-runtime-api.ts";
|
||||
import {
|
||||
@@ -177,14 +177,16 @@ describe("line setup wizard", () => {
|
||||
});
|
||||
|
||||
describe("probeLineBot", () => {
|
||||
beforeEach(async () => {
|
||||
vi.resetModules();
|
||||
beforeAll(async () => {
|
||||
({ probeLineBot } = await import("./probe.js"));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
getBotInfoMock.mockReset();
|
||||
MessagingApiClientMock.mockReset();
|
||||
MessagingApiClientMock.mockImplementation(function () {
|
||||
return { getBotInfo: getBotInfoMock };
|
||||
});
|
||||
({ probeLineBot } = await import("./probe.js"));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -233,10 +235,6 @@ describe("linePlugin status.probeAccount", () => {
|
||||
pictureUrl: "https://example.com/bot.png",
|
||||
});
|
||||
|
||||
const { linePlugin: freshLinePlugin } = await import("./channel.js");
|
||||
const { clearLineRuntime: clearFreshLineRuntime } = await import("./runtime.js");
|
||||
const { probeLineBot: directProbeLineBot } = await import("./probe.js");
|
||||
clearFreshLineRuntime();
|
||||
const params = {
|
||||
cfg: {} as OpenClawConfig,
|
||||
account: {
|
||||
@@ -249,8 +247,10 @@ describe("linePlugin status.probeAccount", () => {
|
||||
timeoutMs: 50,
|
||||
};
|
||||
|
||||
await expect(freshLinePlugin.status!.probeAccount!(params)).resolves.toEqual(
|
||||
await directProbeLineBot("token", 50),
|
||||
clearLineRuntime();
|
||||
|
||||
await expect(linePlugin.status!.probeAccount!(params)).resolves.toEqual(
|
||||
await probeLineBot("token", 50),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user