Test/682 referral panel - #568
Open
Nusirat12345 wants to merge 4 commits into
Open
Conversation
- src/frontend/components/scout/ReferralPanel.ts: - ReferralPanel class driven by injected deps (getReferralStats, generateReferralCode, copyToClipboard) - loadStats(): loading flag, populates stats on success, sets error on failure - generateCode(): generating flag, double-submit guard, appends code on success - copyCode(id, text): sets copiedCodeId on success, sets error on failure - clearCopied(): resets copiedCodeId to null - getState(): returns a snapshot copy of current state - tests/frontend/components/scout/ReferralPanel.test.ts: - Initial state: null stats, empty codes, all flags false - loadStats: loading=true during request, stats populated after, error on failure - loadStats: non-Error rejection gets fallback message - loadStats: previous error cleared on subsequent success - generateCode: generating=true during request, appended to codes after - generateCode: double-submit guard (second concurrent call is no-op) - generateCode: failure sets error, codes unchanged - copyCode: copiedCodeId set on success, correct text passed to clipboard - copyCode: error set on clipboard failure, copiedCodeId NOT set - clearCopied: resets copiedCodeId to null; safe to call when already null - Error propagation: error accessible for all three failure paths - Successful operation after failure clears the error (Toast path)
- src/controllers/apiKeyController.ts: remove unused touchApiKeyLastUsed
import (it is accessed via lazy require in auth.ts, not statically here)
- tests/frontend/components/scout/ReferralPanel.test.ts:
- Fix parsing error: replace curly apostrophe in test description with
plain text to avoid ESLint/parser treating it as a quote delimiter
- Change let capturedLoading / capturedGenerating to const (prefer-const)
- tests/frontend/hooks/useRequireSubscription.test.ts:
- Remove unused PUBLIC_KEY constant (no-unused-vars)
The test file lives four directories below the project root (tests/frontend/components/scout/) so the import needs four levels of ../ to reach src/, not three. Wrong: '../../../src/frontend/components/scout/ReferralPanel' Fixed: '../../../../src/frontend/components/scout/ReferralPanel' All 85 frontend tests now pass.
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.
No description provided.