refactor: extract test user data and improve "New offers" test flow

- Extract test user data (seed phrases, DIDs, usernames) from importUser into separate getTestUserData function
- Refactor importUser to use getTestUserData internally, maintaining backward compatibility
- Update "New offers for another user" test to use new getTestUserData function
- Replace hardcoded seed phrase with programmatic retrieval using getTestUserData('00')
- Add proper TypeScript type annotations to array functions in testUtils
- Improve test maintainability by centralizing test user data management

This allows tests to access user data without executing import flow, providing more flexibility for test scenarios.
This commit is contained in:
Matthew Raymer
2025-07-24 09:31:39 +00:00
parent 53282b4237
commit 9c3d2792ae
7 changed files with 75 additions and 24 deletions

View File

@@ -828,15 +828,19 @@ export default class ContactsView extends Vue {
* Handle registration prompt for new contacts
*/
private async handleRegistrationPrompt(newContact: Contact): Promise<void> {
console.log("[ContactsView] handleRegistrationPrompt", this.isRegistered, this.hideRegisterPromptOnNewContact, newContact.registered);
if (
!this.isRegistered ||
this.hideRegisterPromptOnNewContact ||
newContact.registered
this.isRegistered === false || // the current Identity is not registered OR
this.hideRegisterPromptOnNewContact === true || // the user has hidden the registrationprompt OR
newContact.registered === true // the new contact is already registered
) {
// if any of the above are true, we do not want to show the registration prompt
console.log("[ContactsView] handleRegistrationPrompt we do not want to show the registration prompt");
return;
}
setTimeout(() => {
console.log("[ContactsView] handleRegistrationPrompt setTimeout");
this.$notify(
{
group: "modal",
@@ -844,18 +848,22 @@ export default class ContactsView extends Vue {
title: "Register",
text: "Do you want to register them?",
onCancel: async (stopAsking?: boolean) => {
console.log("[ContactsView] handleRegistrationPrompt onCancel", stopAsking);
await this.handleRegistrationPromptResponse(stopAsking);
},
onNo: async (stopAsking?: boolean) => {
console.log("[ContactsView] handleRegistrationPrompt onNo", stopAsking);
await this.handleRegistrationPromptResponse(stopAsking);
},
onYes: async () => {
console.log("[ContactsView] handleRegistrationPrompt onYes");
await this.register(newContact);
},
promptToStopAsking: true,
},
-1,
);
console.log("[ContactsView] handleRegistrationPrompt setTimeout done");
}, 1000);
}