- move static mockups from resource/ui to mockup/ - move React app scaffold from resource/ui to app/ - move prome.md + images to docs/ - drop empty resource/jsonfile and resource/ - add root .gitignore - rewrite README for new layout - fix paths in mockup/index.html (resource/ui -> mockup, docs/prome.md)
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
const executeRequest = vi.fn();
|
|
|
|
vi.mock("@agent-native/core/provider-api", () => ({
|
|
createProviderApiRuntime: () => ({ executeRequest }),
|
|
}));
|
|
|
|
const { default: action, requiresProviderApiApproval } =
|
|
await import("./provider-api-request");
|
|
|
|
describe("provider-api-request", () => {
|
|
beforeEach(() => {
|
|
executeRequest.mockReset();
|
|
});
|
|
|
|
it("routes Slack reads through the shared provider runtime", async () => {
|
|
executeRequest.mockResolvedValue({ ok: true, team: "Example" });
|
|
|
|
await expect(
|
|
action.run({ provider: "slack", method: "GET", path: "/auth.test" }),
|
|
).resolves.toEqual({ ok: true, team: "Example" });
|
|
expect(executeRequest).toHaveBeenCalledWith({
|
|
provider: "slack",
|
|
method: "GET",
|
|
path: "/auth.test",
|
|
});
|
|
});
|
|
|
|
it("requires approval for provider writes", () => {
|
|
expect(requiresProviderApiApproval({ method: "GET" })).toBe(false);
|
|
expect(requiresProviderApiApproval({ method: "HEAD" })).toBe(false);
|
|
expect(requiresProviderApiApproval({ method: "POST" })).toBe(true);
|
|
});
|
|
});
|