test(portal): cover the onboarding password generator - #945
kingmakeruix wants to merge 1 commit into
Conversation
Adds the missing Portal test plumbing and focused tests for generateStrongPassword, the handoff password an administrator creates when welcoming a new Formulus user. - wire up `pnpm run test` (vitest) in package.json, using the same vitest version the monorepo already uses in desktop and formulus-formplayer - keep the vitest config in vite.config.ts, matching formulus-formplayer - stub only the entropy source with a seeded xorshift32 so every assertion is reproducible; production randomness is untouched - cover the default length, the 12 character minimum, longer requests, one character per class, and the documented look-alike exclusions Refs OpenDataEnsemble#908
|
Hi @kingmakeruix Please always comment on the issues and request them to be assigned to you before opening a PR 😊 Once they are assigned then we can go ahead and open a PR. Thanks for the contribution again |
|
We also invite you to please join the Community Forum HERE |
|
@najuna-brian Thanks for the correction — understood. I have commented on #908 requesting assignment, and I will ask for the issue to be assigned before opening a PR from now on instead of after. I also went back to #912 for #947, so both are in the right order now, and I will not push further changes to either branch until the assignment is granted. Thanks again, and thanks for the forum invitation — I will join and introduce myself. |
What
Adds the missing test plumbing to
synkronus-portaland focused, deterministic tests forgenerateStrongPassword— the handoff password an administrator creates when welcoming a new Formulus user.pnpm run test(vitest) wired up insynkronus-portal/package.json, using the same vitest version (^3.2.7) the monorepo already has indesktopandformulus-formplayervite.config.ts(rather than a new file), matching howformulus-formplayerdoes itpnpm run testadded to the pre-flight list insynkronus-portal/AGENTS.mdWhy
The generator guarantees a minimum length, one character per class, and the exclusion of look-alike characters (
0,O,1,l,I) — all of it was untested, so a change to the character sets would have been invisible. This is the onboarding path for every new Portal user.Production randomness is untouched. Only the entropy source is stubbed (seeded xorshift32 over
crypto.getRandomValues), so every assertion is reproducible and the suite cannot go flaky.Testing
From
synkronus-portal/:Coverage of
generateStrongPassword:4,0,-5all clamp up to 1224and64are honoured0,O,1,l,Iin a 256 character passwordThe look-alike test is a real guard, not a tautology: adding
Oto theUPPERset makes it fail, and reverting makes it pass again.Scope is limited to this utility and its test setup, as the issue asks — no wider Portal test-suite migration.
Closes #908