test(vendors,po): add co-located unit tests for VendorsService and PurchaseOrdersService - #1373
Merged
yusuftomilola merged 1 commit intoAug 26, 2026
Conversation
…rchaseOrdersService Covers findAll with pagination/search, findById, create, update, delete (vendor), and full PO lifecycle: create, update, submit, approve, receive, cancel. Tests all state-transition guard paths and the open-PO guard on vendor delete. Replaces the single misplaced assertions in ibinola.spec.ts. Closes DistinctCodes#1288
|
@Gracora is attempting to deploy a commit to the naijabuz's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Gracora Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
yusuftomilola
approved these changes
Aug 26, 2026
yusuftomilola
left a comment
Collaborator
There was a problem hiding this comment.
No merge conflicts with main. Good co-located unit test coverage for VendorsService and PurchaseOrdersService - approving.
4 tasks
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
Closes #1288
Closes #1289
Closes #1290
Closes #1291
Adds co-located
vendors.service.spec.ts(11 tests) andpurchase-orders.service.spec.ts(22 tests) covering every public method in both services, replacing the single happy-path assertions inibinola.spec.tswith focused, discoverable coverage.Why
The only tests touching
VendorsServiceandPurchaseOrdersServicewere twoit()blocks inbackend/src/ibinola.spec.ts— a file bundling unrelated modules. Coverage missedVendorsService.update(),delete()with the open-PO guard, and the full PO status state machine (submit, approve, receive, cancel). Co-locating tests with the modules they exercise follows the project convention and makes failures immediately attributable.What was built
backend/src/vendors/vendors.service.spec.ts:findAllfindByIdNotFoundExceptionfor missing idcreateupdateNotFoundExceptionfor missing iddeleteNotFoundException;BadRequestExceptionwhen open POs exist; allows delete when all POs are RECEIVEDbackend/src/purchase-orders/purchase-orders.service.spec.ts:findAllfindByIdNotFoundExceptioncreateupdateNotFoundException;BadRequestExceptionfor non-DRAFT; replaces line itemssubmitBadRequestExceptionfor non-DRAFT;NotFoundExceptionapproveBadRequestExceptionfor non-SUBMITTEDreceiveBadRequestExceptionfor non-APPROVEDcancelBadRequestExceptionfor APPROVED;BadRequestExceptionfor RECEIVED;NotFoundExceptionNo existing files modified — only additions, so regression risk is low.
Acceptance criteria coverage
Test plan
npm testinbackend/— 33/33 passing (all new tests for this feature)Env vars / Notes
No new environment variables. Tests use lightweight Jest mocks for TypeORM repositories — no database connection required.