Context
PR #768 added 32 unit tests for the Teams adapter's pure helper functions (escapeHtml, stripHtml, formatTeamsMessage, parseTokens, base64url, validateGraphId). These cover the exported utilities well.
However, the class methods remain untested:
ensureAuthenticated() — token lifecycle (cache/refresh/PKCE/device code)
ensureChat() — chat creation/lookup
postUpdate() — message posting to chats and channels
pollForReplies() — message polling with filtering
These require Graph API mocking but are the highest-risk code paths.
What to do
Add integration tests using a mocked fetch (e.g., vi.stubGlobal('fetch', ...) or msw) that cover:
- Token refresh flow (expired → refresh → success)
- Token refresh failure → re-auth fallback
postUpdate to chat vs channel
pollForReplies filtering out own messages
pollForReplies error → warning logged + empty array returned
ensureChat with recipientUpn vs me mode
Origin
Flagged by FIDO (quality review) during PR #768 review — Round 2 non-blocking note.
Severity: MEDIUM (future work)
Related PR: #768
Context
PR #768 added 32 unit tests for the Teams adapter's pure helper functions (
escapeHtml,stripHtml,formatTeamsMessage,parseTokens,base64url,validateGraphId). These cover the exported utilities well.However, the class methods remain untested:
ensureAuthenticated()— token lifecycle (cache/refresh/PKCE/device code)ensureChat()— chat creation/lookuppostUpdate()— message posting to chats and channelspollForReplies()— message polling with filteringThese require Graph API mocking but are the highest-risk code paths.
What to do
Add integration tests using a mocked
fetch(e.g.,vi.stubGlobal('fetch', ...)ormsw) that cover:postUpdateto chat vs channelpollForRepliesfiltering out own messagespollForReplieserror → warning logged + empty array returnedensureChatwithrecipientUpnvsmemodeOrigin
Flagged by FIDO (quality review) during PR #768 review — Round 2 non-blocking note.
Severity: MEDIUM (future work)
Related PR: #768