Skip to content

Commit e9078b3

Browse files
committed
fix(msteams): isolate probe test env credentials
1 parent d2e8ed3 commit e9078b3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

extensions/msteams/src/probe.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, expect, it, vi } from "vitest";
1+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
22
import type { MSTeamsConfig } from "../runtime-api.js";
33

44
const hostMockState = vi.hoisted(() => ({
@@ -20,6 +20,17 @@ vi.mock("@microsoft/agents-hosting", () => ({
2020
import { probeMSTeams } from "./probe.js";
2121

2222
describe("msteams probe", () => {
23+
beforeEach(() => {
24+
hostMockState.tokenError = null;
25+
vi.stubEnv("MSTEAMS_APP_ID", "");
26+
vi.stubEnv("MSTEAMS_APP_PASSWORD", "");
27+
vi.stubEnv("MSTEAMS_TENANT_ID", "");
28+
});
29+
30+
afterEach(() => {
31+
vi.unstubAllEnvs();
32+
});
33+
2334
it("returns an error when credentials are missing", async () => {
2435
const cfg = { enabled: true } as unknown as MSTeamsConfig;
2536
await expect(probeMSTeams(cfg)).resolves.toMatchObject({
@@ -28,7 +39,6 @@ describe("msteams probe", () => {
2839
});
2940

3041
it("validates credentials by acquiring a token", async () => {
31-
hostMockState.tokenError = null;
3242
const cfg = {
3343
enabled: true,
3444
appId: "app",

0 commit comments

Comments
 (0)