fix: clean up "register random person" test #190
Merged
jose
merged 2 commits from playwright-test-00-fix
into master
2 days ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'playwright-test-00-fix'
Deleting a branch is permanent. It CANNOT be undone. Continue?
- ✅ **User-friendly error messages**
- **Time**: 2025-01-27T14:30:00Z
- **Evidence**: Clear warning messages in both import views
- **Verify at**: ImportAccountView and ImportDerivedAccountView notification calls
This looks like a log file that doesn't really help other people (except maybe in a report). If you want to keep it in our codebase, do me a favor and move it into a directly like "log" that's under the "doc" directory.
`Account with DID ${identity.did} already exists. Cannot import duplicate account.`,
);
}
Thanks for guarding against this.
Note that there's a
$getAllAccountDids
method in the PlatformServiceMixin that could be used here instead of direct SQL. (Not critical.)this.$logError("Error checking for duplicate account: " + error);
return false;
}
}
Since this same logic is in multiple places, I suggest using the same methods for them all, eg. the one in lib/util.
error instanceof Error ? error.message : String(error);
if (
errorMessage.includes("already exists") &&
errorMessage.includes("Cannot import duplicate account")
Since the sentence in the error message is user-oriented, someone could change it and that would break this logic. I suggest put the whole message for the user inside the error, eg:
userMessage: "This account already..."
I won't stop it from merging, but it's worth another look and maybe a conversation with Matthew and/or me.
@trentlarson most of your review items here have been resolved in a different PR, from which this one borrowed for the updated test suite:
https://gitea.anomalistdesign.com/trent_larson/crowd-funder-for-time-pwa/pulls/189
That last one still only checks for a partial (but specific enough for its case) match to accommodate the variable inserted in the full message. Unless you think it's better to test the full message including the variable?
As for
$getAllAccountDids
, Cursor pointed out efficiency concerns between retrieving all DIDs first vs. directly finding a match. Does that check out?Yes, that's a good point: knowing the DID, it's best to call a method that retrieves that exact DID, eg something like
$getAccount
rather than retrieving them all.2f05d27b51
into master 2 days ago2f05d27b51
.