Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test: Improve create teams handler tests#25213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
sean-brydon merged 2 commits intomainfromtests/createTeams-handler-test
Nov 17, 2025

Conversation

@sean-brydon
Copy link
Member

@sean-brydonsean-brydon commentedNov 17, 2025
edited by cubic-dev-aibot
Loading

I am refactoring create teams handler to a service in another PR - thought we should improve the test in the mean time.


Summary by cubic

Expand and restructure tests for createTeamsHandler to cover auth, org/slug validation, team creation and migration, redirects, credits, invites, and subscriptions. This improves reliability ahead of the service refactor.

  • Refactors
    • Rewrote tests into scenario-based suites for Authorization, Organization Validation, Slug Validation, Team Creation/Migration, Redirects, and Edge Cases.
    • Added helpers (createTestProfile, flexible createScenario/createTestMembership) and organization/profile support to model slug collisions.
    • Assert TRPCError codes/messages and redirect records; cover platform orgs, unpublished/non-existent teams, and empty names.
    • Mocked Stripe subscription cancel and inviteMembersWithNoInviterPermissionCheck; verified credit transfer and owner memberships.

Written for commit8c216c6. Summary will update automatically on new commits.

@graphite-appgraphite-appbot requested a review froma teamNovember 17, 2025 10:24
@keithwillcodekeithwillcode added consumer corearea: core, team members only labelsNov 17, 2025
Copy link
Contributor

@cubic-dev-aicubic-dev-aibot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

1 issue found across 1 file

Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.<file name="packages/trpc/server/routers/viewer/organizations/__tests__/createTeams.handler.test.ts"><violation number="1" location="packages/trpc/server/routers/viewer/organizations/__tests__/createTeams.handler.test.ts:189">The new &quot;NoOrganizationError&quot; test still asserts a FORBIDDEN/not_authorized response, so it never verifies the missing-organization error path and simply duplicates the previous authorization test.</violation></file>

Reply to cubic to teach it or ask questions. Re-run a review with@cubic-dev-ai review this PR

creationSource:CreationSource.WEBAPP,
},
})
).rejects.toMatchObject({
Copy link
Contributor

@cubic-dev-aicubic-dev-aibotNov 17, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The new "NoOrganizationError" test still asserts a FORBIDDEN/not_authorized response, so it never verifies the missing-organization error path and simply duplicates the previous authorization test.

Prompt for AI agents
Address the following comment on packages/trpc/server/routers/viewer/organizations/__tests__/createTeams.handler.test.ts at line 189:<comment>The new &quot;NoOrganizationError&quot; test still asserts a FORBIDDEN/not_authorized response, so it never verifies the missing-organization error path and simply duplicates the previous authorization test.</comment><file context>@@ -123,354 +139,1120 @@ async function createScenario(options: CreateScenarioOptions = {}) {+            creationSource: CreationSource.WEBAPP,+          },+        })+      ).rejects.toMatchObject({+        code: &quot;FORBIDDEN&quot;,+        message: &quot;not_authorized&quot;,</file context>
Fix with Cubic

Copy link
Contributor

@eunjae-leeeunjae-lee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This looks solid !

Copy link
Contributor

@rodrigoehlersrodrigoehlers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM!

@sean-brydonsean-brydon merged commitf0e1012 intomainNov 17, 2025
83 of 87 checks passed
@sean-brydonGraphite App
Copy link
MemberAuthor

Merge activity

@sean-brydonsean-brydon deleted the tests/createTeams-handler-test branchNovember 17, 2025 11:08
@sean-brydonsean-brydon restored the tests/createTeams-handler-test branchNovember 17, 2025 11:19
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@cubic-dev-aicubic-dev-ai[bot]cubic-dev-ai[bot] left review comments

@eunjae-leeeunjae-leeeunjae-lee approved these changes

+1 more reviewer

@rodrigoehlersrodrigoehlersrodrigoehlers approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

consumercorearea: core, team members onlyready-for-e2esize/XXL

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@sean-brydon@eunjae-lee@rodrigoehlers@keithwillcode

[8]ページ先頭

©2009-2025 Movatter.jp