Skip to content

test(sharepoint): skip integration suite when credentials are missing - #778

Open
siddhanttiwari19 wants to merge 1 commit into
corsairdev:mainfrom
siddhanttiwari19:test/sharepoint-724
Open

test(sharepoint): skip integration suite when credentials are missing#778
siddhanttiwari19 wants to merge 1 commit into
corsairdev:mainfrom
siddhanttiwari19:test/sharepoint-724

Conversation

@siddhanttiwari19

@siddhanttiwari19 siddhanttiwari19 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #724

createSharepointClient() returned null when SHAREPOINT_ACCESS_TOKEN/SHAREPOINT_SITE_ID were unset, and every test in packages/sharepoint/integration.test.ts bailed early with if (!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 hasCredentials
const describeIf = hasCredentials ? describe : describe.skip;, wrapping the whole suite
One-time console.warn when credentials are missing
Removed the 12 if (!setup) return; guards. Left the two unrelated if (!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:

  • I have run pnpm lint and all checks pass
  • I have run pnpm typecheck and there are no TypeScript errors
  • I have run pnpm build and all packages build successfully
  • I have run pnpm test and all tests pass
  • I have added or updated tests where applicable
  • I have added or updated necessary documentation

Screenshots / Demos (if applicable)

image

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

  • Tests
    • Improved SharePoint integration test setup by validating required credentials before running.
    • Added a clear warning when integration tests are skipped due to missing credentials.
    • Preserved conditional skips for tests requiring specific permissions or capabilities.

@vercel

vercel Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

@siddhanttiwari19 is attempting to deploy a commit to the corsair Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the plugin Changes inside a plugin package label Aug 15, 2026
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 986cd336-44da-424d-90cb-eb3d4a1be90a

📥 Commits

Reviewing files that changed from the base of the PR and between 6e3c394 and 8c41349.

📒 Files selected for processing (1)
  • packages/sharepoint/integration.test.ts

📝 Walkthrough

Walkthrough

SharePoint 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.

Changes

SharePoint integration test gating

Layer / File(s) Summary
Centralize credentials and gate the suite
packages/sharepoint/integration.test.ts
Credentials are discovered once. The suite logs a warning and uses describeIf when credentials are missing.
Remove redundant setup-null guards
packages/sharepoint/integration.test.ts
Tests assume setup succeeds when the suite runs. Existing permission-dependent skips remain.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 8c413

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: yashksaini-coder

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: skipping the SharePoint integration suite when required credentials are missing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes missing SharePoint credentials explicitly skip the integration suite instead of allowing individual tests to return early and appear to pass.

  • Reads and normalizes the access token and site ID once at module initialization.
  • Selects describe or describe.skip based on credential availability and emits one warning when credentials are absent.
  • Removes redundant per-test credential guards while retaining list-availability guards.

Confidence Score: 5/5

The 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

Filename Overview
packages/sharepoint/integration.test.ts Replaces assertion-free early returns with suite-level credential gating; no actionable defect was found.

Reviews (1): Last reviewed commit: "test(sharepoint): skip integration suite..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin Changes inside a plugin package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(sharepoint): skip integration suite when credentials are missing

1 participant