#8964: test(msteams): add comprehensive tests for graph-upload module
channel: msteams
gateway
commands
stale
Cluster:
Test Coverage Enhancements
## Summary
Adds unit tests for the MS Teams graph-upload module which previously had no test coverage.
## Changes
- Add 23 new tests covering all exported functions in `graph-upload.ts`
- Tests cover success cases, error handling, and edge cases
- Uses mock fetch pattern consistent with other msteams tests
## Testing
- [x] All tests pass locally (`npx vitest run extensions/msteams/src/graph-upload.test.ts`)
- [x] No TypeScript errors
## Checklist
- [x] Tests focused on one module
- [x] Follows existing testing patterns
- [x] AI-assisted (Claude Opus 4.5 with Copilot)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds a new Vitest test suite for the MS Teams `graph-upload` module, covering OneDrive/SharePoint upload helpers, sharing-link creation, drive-item property lookups, and chat member retrieval via injected `fetchFn` and a mocked access token provider.
The approach mirrors the module’s dependency-injection pattern (passing `fetchFn` + token provider) and exercises both success and error paths for the exported functions in `extensions/msteams/src/graph-upload.ts`.
<h3>Confidence Score: 3/5</h3>
- This PR is low-risk functionally, but several test assertions appear to be incorrect and may fail in CI.
- Only a new test file is added, but multiple expectations don’t match the actual error strings thrown by the implementation (notably where response bodies are appended). I couldn’t execute tests in this environment (node/pnpm unavailable), so confidence relies on static verification against the source.
- extensions/msteams/src/graph-upload.test.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#15569: test: comprehensive test coverage expansion (57 new test files)
by tangcruz · 2026-02-13
79.7%
#10902: fix(msteams): fix inline pasted image downloads
by jlian · 2026-02-07
79.5%
#9333: Tests: add test coverage for security/audit-fs.ts
by M00N7682 · 2026-02-05
78.4%
#12684: Test: add missing unit tests for src/utils modules
by shaynhornik · 2026-02-09
77.5%
#22884: feat(msteams): add resumable upload sessions with retry and range-a...
by chansuke · 2026-02-21
77.1%
#12876: major test workflow: enhance coverage infrastructure
by Mathbkj · 2026-02-09
76.6%
#4095: Test/add format duration tests
by TechWizard9999 · 2026-01-29
76.5%
#4137: [AI-assisted] test(cli): add missing test cases for parseDurationMs
by sind00 · 2026-01-29
76.4%
#20496: test(utils): add comprehensive unit tests for utility functions
by masifislamm · 2026-02-19
76.3%
#11421: Tests: add unit tests for infra/format-duration
by PythonUser42 · 2026-02-07
76.1%