Repository navigation
refactor: split test suites and the scan runner - #51
Merged
Merged
Conversation
The detail route goes from 209 to 17 lines: employee, breach and alert builders move to src/lib/entity-detail, with the MFA label and remediation group shared. The kind lookup uses Object.hasOwn so inherited names such as constructor still get a 400. All 60 entities of the demo data, the 400, 404 and 401 cases return byte-identical responses.
263 lines become bootstrap.itest.ts (94, the start-up entry point), bootstrap-admin.itest.ts (141, state and first-admin creation) and bootstrap.fixtures.ts (the rolled-back empty database). Same 16 tests, all passing.
242 lines become invitation.itest.ts (issuing, 96), invitation-consume.itest.ts (redeeming, 114) and invitation.fixtures.ts, which gives each suite its own company so they can run in parallel. Same 14 tests, all passing.
400 lines become invitation-routes.itest.ts (invite route, rate ceiling, rotation gate, 147), invitation-rotation.itest.ts (forced rotation, acceptance, password change, 181) and a fixture giving each suite its own companies and mocks. Same 21 tests, all passing.
311 lines become user-create.itest.ts (156), user-create-escalation.itest.ts (50) and a fixture with a post() helper replacing the repeated six-line request literal. Comments become one sentence each. Same 8 tests, all passing.
runner.ts goes from 394 to 123 lines: severity and confidence move to severity.ts, finding persistence and corroboration to findings.ts, the retried lookup and check recording to lookup.ts. Its tests split the same way (severity, findings, checks), same 20 tests. No logic change.
Moving the builders into src/lib brought them under the coverage floor untested, and the new integration fixtures were counted as uncovered app code. The builders now have unit tests, fixtures are excluded like test files, and the floor rises to 57% of statements.
708 lines become five suites (model and helpers, permission gate, provider routes, domain verification, resolve and mandatory policy) and sso.fixtures.ts. Each suite now cleans only its own providers instead of every itest- one, so parallel suites cannot delete each other's rows. Comments become one sentence each. Same 21 tests; the full integration run passes twice in a row (110 tests).
| export async function stubProviderRegistration(ownerId: string) { | ||
| return vi.spyOn(auth.api, "registerSSOProvider").mockImplementation(async (args) => { | ||
| if (!args) throw new Error("registerSSOProvider stub called without args") | ||
| if (!args) throw new Error("registerSSOProvider stub called without args") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #30. Five oversized test suites (auth bootstrap, invitation integration and routes, SSO user creation, SSO integration) are split by theme, with the same tests.
The scan runner moves its severity rules into their own module, and the dashboard drawer detail builders move to lib with new unit tests. No behaviour change.