test(sharepoint): skip integration suite when credentials are missing - #778
test(sharepoint): skip integration suite when credentials are missing#778siddhanttiwari19 wants to merge 1 commit into
Conversation
|
@siddhanttiwari19 is attempting to deploy a commit to the corsair Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughSharePoint integration tests now read credentials once, skip the full suite when credentials are unavailable, and remove redundant per-test setup-null guards. Existing permission- and capability-dependent skips remain. ChangesSharePoint integration test gating
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized test-only change skips the SharePoint integration suite when credentials are absent and preserves credentialed test behavior; no actionable merge-blocking risk remains. Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR makes missing SharePoint credentials explicitly skip the integration suite instead of allowing individual tests to return early and appear to pass.
Confidence Score: 5/5The PR appears safe to merge because missing credentials correctly skip the SharePoint integration callbacks while configured runs continue to exercise the API. The suite gate and client helper use the same credential snapshot, Jest does not execute hooks or tests in a skipped suite, and the helper has no callers outside that suite. Important Files Changed
Reviews (1): Last reviewed commit: "test(sharepoint): skip integration suite..." | Re-trigger Greptile |
Description
Fixes #724
createSharepointClient()returnednullwhenSHAREPOINT_ACCESS_TOKEN/SHAREPOINT_SITE_IDwere unset, and every test inpackages/sharepoint/integration.test.tsbailed early withif (!setup) return;. Jest counts that early return as a pass, so the suite reported green (13/13) without ever exercising an assertion against the real API.This mirrors the fix already merged for Teams/OneDrive in #735:
Read both env vars once at module scope and compute
hasCredentialsconst describeIf = hasCredentials ? describe : describe.skip;, wrapping the whole suiteOne-time
console.warnwhen credentials are missingRemoved the 12 i
f (!setup) return; guards. Left the two unrelatedif (!listTitle) return;checks alone — those skip when a tenant has no listable, non-hidden list, which is legitimate runtime behavior, not a credentials bypass.Checklist
Before submitting your PR, please verify the following:
pnpm lintand all checks passpnpm typecheckand there are no TypeScript errorspnpm buildand all packages build successfullypnpm testand all tests passScreenshots / Demos (if applicable)
Additional Notes
No behavior change for real test runs with credentials configured — this only affects reporting when SHAREPOINT_ACCESS_TOKEN/SHAREPOINT_SITE_ID are absent (e.g. CI without secrets, or local dev without a SharePoint tenant). No breaking changes, no new dependencies.
Summary by CodeRabbit