forked from jsnbuchanan/crowd-funder-for-time-pwa
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:
@@ -693,6 +693,7 @@ export class WebPlatformService implements PlatformService {
|
||||
const setClause = keys.map((key) => `${key} = ?`).join(", ");
|
||||
const sql = `UPDATE settings SET ${setClause} WHERE accountDid = ?`;
|
||||
const params = [...keys.map((key) => settings[key]), did];
|
||||
console.log("[WebPlatformService] updateDidSpecificSettings", sql, JSON.stringify(params, null, 2));
|
||||
await this.dbExec(sql, params);
|
||||
}
|
||||
|
||||
|
||||
@@ -707,6 +707,7 @@ export const PlatformServiceMixin = {
|
||||
// Merge with any provided defaults (these take highest precedence)
|
||||
const finalSettings = { ...mergedSettings, ...defaults };
|
||||
|
||||
console.log("[PlatformServiceMixin] $accountSettings", JSON.stringify(finalSettings, null, 2));
|
||||
return finalSettings;
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Raymer * @version 1.0.0 */
|
||||
<TopMessage />
|
||||
|
||||
<!-- CONTENT -->
|
||||
<section id="Content" class="p-6 pb-24 max-w-3xl mx-auto">
|
||||
<section id="Content" class="p-6 pb-24 max-w-3xl mx-auto" :data-active-did="activeDid">
|
||||
<h1 id="ViewHeading" class="text-4xl text-center font-light mb-8">
|
||||
{{ AppString.APP_NAME }}
|
||||
<span class="text-xs text-gray-500">{{ package.version }}</span>
|
||||
|
||||
@@ -189,6 +189,7 @@ export default class ImportAccountView extends Vue {
|
||||
* Uses importFromMnemonic utility for secure import
|
||||
*/
|
||||
public async onImportClick() {
|
||||
console.log("[ImportAccountView] onImportClick", this.mnemonic);
|
||||
if (!this.mnemonic?.trim()) {
|
||||
this.notify.warning(
|
||||
"Seed phrase is required to import an account.",
|
||||
@@ -206,6 +207,7 @@ export default class ImportAccountView extends Vue {
|
||||
|
||||
// Check what was actually imported
|
||||
const settings = await this.$accountSettings();
|
||||
console.log("[ImportAccountView] settings", JSON.stringify(settings, null, 2));
|
||||
|
||||
// Check account-specific settings
|
||||
if (settings?.activeDid) {
|
||||
|
||||
Reference in New Issue
Block a user