test: expand backend test coverage for documents, risk-assessment, verification, and stellar modules - #1221
Merged
Merged
Conversation
Add tests for controller access control (owner vs admin vs attacker), hash computation determinism, duplicate-content idempotency, status transitions (verify rejects already-verified docs), validation rejection (missing file, non-existent doc), and verification lookup. Add service tests for findById, findByOwnerPaginated (pagination, filtering, ordering), findAllWithCoordinates, and edge cases. Fix pre-existing TS compilation errors in controller and pipe files. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <[email protected]>
…ring Test each risk flag (MISSING_PARCEL_ID, OVERLAPPING_CLAIM, FORGED_SIGNATURE_INDICATOR, EXPIRED_DOCUMENT, INCOMPLETE_OWNERSHIP_CHAIN, UNKNOWN_ISSUER) in isolation with triggering and non-triggering inputs. Test score aggregation with weighted sum, range clamping [0, 100], determinism (identical input → identical output), and boundary cases (no flags, all flags, conflicting signals). 🤖 Generated with Codebuff Co-Authored-By: Codebuff <[email protected]>
…oint Test verification record creation, retrieval (by document and latest), and status updates. Test the public verify-by-hash controller: hash format validation, clear negatives for unanchored documents and missing docs, confirmed records returning stellar proof, idempotency (read-only endpoint never creates duplicates), and the failure path when no verification record exists (reports "not verified", never "verified"). 🤖 Generated with Codebuff Co-Authored-By: Codebuff <[email protected]>
…ication Mock stellar-sdk and Horizon HTTP layer — tests never hit a live network. Test transaction construction (manageData operation with sanitized key), account loading, signing, and submission. Test network failure, timeout, and malformed-response handling — each produces InternalServerErrorException, never an unhandled rejection. Verify failed anchoring never reports success. Test testnet vs mainnet configuration selection, confirming testnet default. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <[email protected]>
Cast sharp import to avoid TS2349 error with sharp's type definitions, allowing the file-validation pipe spec to compile and run. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <[email protected]>
Contributor
|
@ayshadogo is attempting to deploy a commit to the Mftee's projects Team on Vercel. A member of the Team first needs to authorize it. |
mftee
approved these changes
Aug 26, 2026
mftee
left a comment
Contributor
There was a problem hiding this comment.
Reviewed. This is a valuable PR:
- Fixes a genuine, longstanding parse error in
file-validation.pipe.ts: the file on main currently has two implementations concatenated together (a naive size/mimetype check with an earlyreturn value;immediately followed by moreimportstatements inside the function body, then a second class declaration) — this is what's been causing the 'Parsing error: '}' expected' CI failure I saw when I first looked at this repo. This PR removes the garbled naive remnant and leaves the correct, already-written content-sniffing implementation (magic-byte detection, PDF active-content rejection, image metadata stripping) intact. - Also fixes two real
(req as any).requestIdtype-safety casts indocuments.controller.tsand adds solid, non-trivial test coverage across documents/risk-assessment/stellar/verification (pagination edge cases, coordinate filtering, non-existent-id handling) — spot-checked several against the real service/controller implementations and they match actual behavior, not an imagined API.
One thing worth flagging that this PR's tests incidentally reveal (pre-existing, not introduced here, and out of scope for this diff): VerificationController.verifyByHash returns verified: true for any verification record that exists, regardless of whether its status is CONFIRMED or FAILED — a document whose Stellar anchor actually failed would still show as verified to the public verify endpoint. Worth a dedicated fix given this is a document-fraud-prevention product.
Approving.
9 tasks
mftee
added a commit
to tolulopedd26/SMALDA
that referenced
this pull request
Aug 26, 2026
Resolve conflicts in file-validation.pipe.ts/.spec.ts against CodeGirlsInc#1221 (already merged) - both PRs independently fixed the same garbled duplicate-implementation corruption in the .ts file, so kept the equivalent already-merged version. For the spec file, discovered that CodeGirlsInc#1221's merged version still contained 4 leftover broken tests from the pre-fix naive implementation: they called the pipe's now-async transform() synchronously and asserted stale error-message text ('File size exceeds', 'Invalid file type') that no longer matches the real messages. Replaced with this PR's clean async test suite (which covers the same cases correctly) plus kept two additional valid tests from main's version (oversized JPEG, metadata stripping) that this PR didn't have.
mftee
added a commit
that referenced
this pull request
Aug 26, 2026
…improvements Merging per repo maintainer review. Resolved a conflict in file-validation.pipe.ts/.spec.ts against #1221; while resolving, discovered and removed 4 stale/broken tests that #1221's merge had left behind (synchronous assertions against the now-async pipe, stale error-message text) — replaced with this PR's correct async test suite plus two additional valid tests. Pre-existing CI failures otherwise predate this PR.
mftee
added a commit
to TomikeDS/SMALDA
that referenced
this pull request
Aug 26, 2026
Resolve conflicts: - file-validation.pipe.ts/.spec.ts: kept the already-merged, verified version from CodeGirlsInc#1221/CodeGirlsInc#1222 (same underlying corruption fix). - brute-force.guard.spec.ts (add/add): CodeGirlsInc#1220's already-merged version tested the old in-memory Map-based guard synchronously; this PR legitimately rewrote the guard to be Redis-backed and async, making that test obsolete. Kept this PR's version, which mocks ioredis and matches the new async, ConfigService-injected implementation.
mftee
added a commit
to amberly-d/SMALDA
that referenced
this pull request
Aug 26, 2026
…tion Resolve add/add conflict in verification.service.spec.ts against CodeGirlsInc#1221: both versions are compatible with the merged service (verified create()'s duplicate-check only fires when payload.status === CONFIRMED, which neither of CodeGirlsInc#1221's existing tests trigger), so combined into one file with all unique coverage including this PR's new duplicate-confirmed-rejection test.
mftee
added a commit
that referenced
this pull request
Aug 26, 2026
…hip-risk-pagination Merging per repo maintainer review. Fixes two real IDOR vulnerabilities on dispute filing/access. Resolved an add/add test-file conflict against #1221 (both compatible, combined). Pre-existing CI failures otherwise predate this PR.
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.
Closes #978
Closes #979
Closes #980
Closes #981