Skip to content

fix: use spyOn for controller method assertions in specs - #714

Closed
DeFex-lab wants to merge 1 commit into
MergeFi:mainfrom
DeFex-lab:fix/issue-606-controller-specs-pass-unbound-methods-to-expect
Closed

DeFex-lab wants to merge 1 commit into
MergeFi:mainfrom
DeFex-lab:fix/issue-606-controller-specs-pass-unbound-methods-to-expect

Conversation

@DeFex-lab

Copy link
Copy Markdown

Overview

This PR fixes @typescript-eslint/unbound-method lint errors in the GitHub controller specs, where unbound method references were passed to expect(). The offending assertions are replaced with jest.spyOn-based references so npm run lint can pass while keeping the rule enabled.

Related Issue

Changes

🧪 Controller Spec Fixes

  • [MODIFY] src/github/github.controller.spec.ts

    • Replaces the unbound expect(controller.sync)-style references at lines 62 and 71 with jest.spyOn-based assertions, so the method is referenced through a bound spy rather than an unbound prototype method.
  • [MODIFY] src/github/github-webhooks.controller.spec.ts

    • Replaces the unbound method reference at line 142 with a jest.spyOn-based assertion, consistent with the fix in the other spec.

Verification Results

npm run lint
✅ unbound-method errors at github.controller.spec.ts:62, :71 and github-webhooks.controller.spec.ts:142 resolved
Acceptance Criteria Status
unbound-method errors at github.controller.spec.ts:62 and :71 are resolved ✅ Assertions now use jest.spyOn
unbound-method error at github-webhooks.controller.spec.ts:142 is resolved ✅ Assertion now uses jest.spyOn
The @typescript-eslint/unbound-method rule is kept enabled ✅ No ESLint config changes

Closes #606

@vercel

vercel Bot commented Oct 20, 2026

Copy link
Copy Markdown

@DeFex-lab is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Oct 20, 2026

Copy link
Copy Markdown

@DeFex-lab 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! 🚀

Learn more about application limits

@DeFex-lab
DeFex-lab force-pushed the fix/issue-606-controller-specs-pass-unbound-methods-to-expect branch from 70c8df4 to 51258d6 Compare October 22, 2026 09:54
chonilius added a commit that referenced this pull request Oct 29, 2026
…alidation

fix: wallet disconnect fails silently — add DELETE /users/:id/stellar-address (#714)
Proxima84-code pushed a commit to Proxima84-code/backend that referenced this pull request Oct 31, 2026
…ergeFi#714)

PATCH { stellarAddress: null } always returned 400 because the
@IsStellarAddress() validator on SetStellarAddressDto only accepts a
valid Stellar Ed25519 public key — null never passes StrKey validation.
The disconnect() call on the frontend was silently swallowed by its
.catch(() => {}) so the failure was invisible to users and maintainers.

Adds a dedicated DELETE :id/stellar-address route that accepts no body
and sets user.stellarAddress to null via a new clearStellarAddress()
service method, keeping the PATCH route strictly typed for real
addresses.
Proxima84-code pushed a commit to Proxima84-code/backend that referenced this pull request Oct 31, 2026
MergeFi#714)

Adds two spec blocks:
- users.service.spec.ts: NotFoundException on missing user; null written
  to stellarAddress and persisted via userRepo.save.
- users.controller.spec.ts: wires the clearStellarAddress mock; asserts
  the happy path returns stellarAddress: null and the cross-user attempt
  throws ForbiddenException without calling the service.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Controller specs pass unbound methods to expect() (unbound-method lint errors)

1 participant