test: add unit coverage for ticket/department services and validators - #5
Open
itheCreator1 wants to merge 1 commit into
Open
test: add unit coverage for ticket/department services and validators#5itheCreator1 wants to merge 1 commit into
itheCreator1 wants to merge 1 commit into
Conversation
…r-reporting services Salvages test files from the long-stale test/phase-1-5-comprehensive-testing branch (diverged since Jan 2026) for modules that exist in main today with zero test coverage: adminTicketService, clientTicketService, departmentService, errorReportingService, and their validators (adminTicketValidators, clientValidators, departmentValidators). Ported as standalone files rather than merging the branch (which conflicts on 19 files including package.json and core test infra). Adapted to signature drift since these were written: clientTicketService.getDepartmentTickets moved from (userId, filters) to (userId, department, filters) in v2.2.0, mutation methods gained an auditContext param, and departments now require a floor field. +189 tests, 1004 -> 1193 passing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011tWtJbqWmefyKJUjXcEmfo
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.
Summary
main:adminTicketService,clientTicketService,departmentService,errorReportingService, and their validators (adminTicketValidators,clientValidators,departmentValidators)test/phase-1-5-comprehensive-testingbranch (diverged since Jan 2026), ported as standalone files rather than merged — a straight merge hits 19 conflicts includingpackage.json,models/User.js,config/session.js,jest.config.js, and the shared test helpers, because that branch's own test infrastructure (CSRF handling, session storage) has since been rewrittenclientTicketService.getDepartmentTicketsmoved from(userId, filters)to(userId, department, filters)(v2.2.0 department-based access change)auditContext = {}parameter (recent audit-context threading work)departmentService.createDepartment/validateDepartmentCreatenow require afloorfield (migration 020+)clientTicketService.createTicketnow also passesreporter_name(auto-populated) toTicket.createdepartments,errorReporting,language), which were written against a CSRF-disabled/MemoryStoretest setup that no longer exists —mainnow uses a real CSRF double-submit cookie flow even in tests (tests/helpers/csrf.js)tests/unit/models/Department.test.js—main's current version (1150 lines) supersedes the branch's (678 lines)Test plan
docker-compose exec web npm test— 1193/1193 passing (was 1004; +189 from this PR)docker-compose exec web npm run lint— clean on all touched filesdocker-compose exec web npx prettier --check— clean on all touched files🤖 Generated with Claude Code
https://claude.ai/code/session_011tWtJbqWmefyKJUjXcEmfo