






















@@ -130,7 +130,14 @@ function createFeedbackInvokeContext(params: {
130130}
131131132132async function expectFileMissing(filePath: string) {
133-await expect(access(filePath)).rejects.toMatchObject({ code: "ENOENT" });
133+let error: unknown;
134+try {
135+await access(filePath);
136+} catch (caught) {
137+error = caught;
138+}
139+expect(error).toBeInstanceOf(Error);
140+expect((error as NodeJS.ErrnoException).code).toBe("ENOENT");
134141}
135142136143async function withFeedbackHandler(params: {
@@ -189,12 +196,28 @@ describe("msteams feedback invoke authz", () => {
189196path.join(tmpDir, "msteams_direct_owner-aad.jsonl"),
190197"utf-8",
191198);
192-expect(JSON.parse(transcript.trim())).toMatchObject({
199+const event = JSON.parse(transcript.trim()) as Record<string, unknown>;
200+expect(Object.keys(event).sort()).toEqual([
201+"agentId",
202+"comment",
203+"conversationId",
204+"event",
205+"messageId",
206+"sessionKey",
207+"ts",
208+"type",
209+"value",
210+]);
211+expect(typeof event.ts).toBe("number");
212+expect({ ...event, ts: 0 }).toEqual({
213+type: "custom",
193214event: "feedback",
215+ts: 0,
194216messageId: "bot-msg-1",
195217value: "positive",
196218comment: "allowed feedback",
197219sessionKey: "msteams:direct:owner-aad",
220+agentId: "default",
198221conversationId: "a:personal-chat",
199222});
200223expect(originalRun).not.toHaveBeenCalled();
@@ -232,11 +255,29 @@ describe("msteams feedback invoke authz", () => {
232255path.join(tmpDir, "msteams_direct_owner-aad.jsonl"),
233256"utf-8",
234257);
235-expect(JSON.parse(transcript.trim())).toMatchObject({
258+const event = JSON.parse(transcript.trim()) as Record<string, unknown>;
259+expect(Object.keys(event).sort()).toEqual([
260+"agentId",
261+"comment",
262+"conversationId",
263+"event",
264+"messageId",
265+"sessionKey",
266+"ts",
267+"type",
268+"value",
269+]);
270+expect(typeof event.ts).toBe("number");
271+expect({ ...event, ts: 0 }).toEqual({
272+type: "custom",
236273event: "feedback",
274+ts: 0,
275+messageId: "bot-msg-1",
237276value: "positive",
238277comment: "allowed dm feedback",
239278sessionKey: "msteams:direct:owner-aad",
279+agentId: "default",
280+conversationId: "a:personal-chat",
240281});
241282expect(originalRun).not.toHaveBeenCalled();
242283},
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。