Repository navigation
feat: add dynamic users - #49
Open
mutambaraf wants to merge 12 commits into
Open
mutambaraf wants to merge 12 commits into
mutambaraf wants to merge 12 commits into
Conversation
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
mutambaraf
marked this pull request as ready for review
October 23, 2026 10:41
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.
Description
Rewrites the mock UOWS client in TypeScript. Users are now held in memory and can be created at runtime, instead of being written by hand as static JSON response files.
Users
src/data/users.json(11 users). They are loaded into an in-memoryUserStoreat startup.src/responses/(getbasicpersondetails/,getpersondetailsfromsessionid/,getrolesforuser/, etc.), which have been removed.Usermodel holds each user's data once and renders it into each endpoint's response shape: basic person details, roles and session.UOWS endpoints (same paths as before, now backed by the store)
GET /users-service/v1/basic-person-detailsand/basic-person-details/searchable(byuserNumbers,emailsorsurname)GET /users-service/v1/role/{userNumber}GET /users-service/v1/sessions/{sessionId}POST /users-service/v1/tokenPOSTandDELETE /users-service/v1/group-memberships/fapNew endpoints for managing the mock
POST /mock-server/userswith{ "userCount": 100, "startUserNumber": 1000 }generates users with Faker.startUserNumberis optional and defaults to the number after the highest existing user. The count is capped byMAX_USERS_PER_REQUEST, which defaults to 1000. If any requested user number is already taken, it returns 409 and creates none of the users.POST /mock-server/resetdrops generated users and reseeds fromusers.json.GET /mock-server/statusreturns{ status, totalUsers }.Tooling and build
npm run buildcompiles todist/), with oxlint (type-aware), Prettier, and a Husky + lint-staged pre-commit hook.node:24.22-alpine.CI and releases
build-image-test.ymlnow pushes an image for every PR, tagged with the branch name (e.g.stfc-mockserver-client:46-add-dynamic-users), so a branch can be tested with core before merging. It skips the push for dependabot and fork PRs.build-push.ymlnow works like core's release workflow. On every merge intomaster:fixgives a patch,feata minor,!a major):vX.Y.Zand:latestchore(deps):titles.Motivation and Context
Adding a user used to mean hand-writing JSON files in three separate folders, which doesn't scale to load testing or to tests that need many users. With one data file, an in-memory store and a generation endpoint, users can be added in one place or created in bulk at runtime. The rewrite also brings the repo in line with user-office-core: TypeScript, linting, tests in CI, and automatic versioned releases.
How Has This Been Tested
-We have added tests, run using
npm testFixes
Closes #46
Changes
src/index.ts→dist/index.js).src/mockserver.jsandsrc/responses/have been removed.:vX.Y.Zand:latest.:masteris no longer published.src/data/users.json, and the/mock-server/users,/mock-server/resetand/mock-server/statusendpoints.Depends on
Nothing needs to be merged first, but before or when merging:
apps/backend/docker-compose-stfc.e2e.ymlpullsstfc-mockserver-client:master. Once this PR is merged, that tag stops being updated, so core needs to switch to:latest(planned as a follow-up).masterasv1.0.0so this PR (feat!) releases asv2.0.0.Tests included/Docs Updated?