mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 18:20:44 +00:00
test(slack,line): reduce hot extension test imports
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const {
|
||||
pushMessageMock,
|
||||
@@ -93,8 +93,11 @@ const LINE_TEST_CFG = {
|
||||
};
|
||||
|
||||
describe("LINE send helpers", () => {
|
||||
beforeEach(async () => {
|
||||
vi.resetModules();
|
||||
beforeAll(async () => {
|
||||
sendModule = await import("./send.js");
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
pushMessageMock.mockReset();
|
||||
replyMessageMock.mockReset();
|
||||
showLoadingAnimationMock.mockReset();
|
||||
@@ -125,7 +128,6 @@ describe("LINE send helpers", () => {
|
||||
pushMessageMock.mockResolvedValue({});
|
||||
replyMessageMock.mockResolvedValue({});
|
||||
showLoadingAnimationMock.mockResolvedValue({});
|
||||
sendModule = await import("./send.js");
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
@@ -3,7 +3,6 @@ import path from "node:path";
|
||||
import ts from "typescript";
|
||||
import { afterEach, 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 {
|
||||
createPluginSetupWizardConfigure,
|
||||
createTestWizardPrompter,
|
||||
@@ -375,30 +374,6 @@ describe("linePlugin status.probeAccount", () => {
|
||||
});
|
||||
|
||||
describe("line runtime api", () => {
|
||||
it("loads through Jiti without duplicate export errors", () => {
|
||||
const runtimeApiPath = path.join(process.cwd(), "extensions", "line", "runtime-api.ts");
|
||||
|
||||
expect(
|
||||
loadRuntimeApiExportTypesViaJiti({
|
||||
modulePath: runtimeApiPath,
|
||||
exportNames: [
|
||||
"buildTemplateMessageFromPayload",
|
||||
"downloadLineMedia",
|
||||
"isSenderAllowed",
|
||||
"probeLineBot",
|
||||
"pushMessageLine",
|
||||
],
|
||||
realPluginSdkSpecifiers: ["openclaw/plugin-sdk/line-runtime"],
|
||||
}),
|
||||
).toEqual({
|
||||
buildTemplateMessageFromPayload: "function",
|
||||
downloadLineMedia: "function",
|
||||
isSenderAllowed: "function",
|
||||
probeLineBot: "function",
|
||||
pushMessageLine: "function",
|
||||
});
|
||||
}, 240_000);
|
||||
|
||||
it("keeps the LINE runtime barrel self-contained", () => {
|
||||
const runtimeApiPath = path.join(process.cwd(), "extensions", "line", "runtime-api.ts");
|
||||
expect(collectRuntimeApiPreExports(runtimeApiPath)).toEqual([]);
|
||||
|
||||
Reference in New Issue
Block a user