Migrate test/index.ts to use dynamic database imports

Replace static databaseUtil import with dynamic import pattern for test context.
Add comprehensive JSDoc documentation and improve code formatting.
Maintains functionality while removing static dependency.
This commit is contained in:
Matthew Raymer
2025-07-09 10:07:49 +00:00
parent f79454c8b5
commit 190b6c7f03
8 changed files with 491 additions and 18 deletions

View File

@@ -365,8 +365,6 @@ import TopMessage from "../components/TopMessage.vue";
import { APP_SERVER, AppString, NotificationIface } from "../constants/app";
import { logConsoleAndDb } from "../db/index";
import { Contact } from "../db/tables/contacts";
// No longer needed - using PlatformServiceMixin methods
// import * as databaseUtil from "../db/databaseUtil";
import { getContactJwtFromJwtUrl } from "../libs/crypto";
import { decodeEndorserJwt } from "../libs/crypto/vc";
import {
@@ -475,7 +473,6 @@ export default class ContactsView extends Vue {
public async created() {
this.notify = createNotifyHelpers(this.$notify);
// Replace databaseUtil.retrieveSettingsForActiveAccount() with mixin method
const settings = await this.$accountSettings();
this.activeDid = settings.activeDid || "";
this.apiServer = settings.apiServer || "";
@@ -544,7 +541,6 @@ export default class ContactsView extends Vue {
if (response.status != 201) {
throw { error: { response: response } };
}
// Replace databaseUtil.updateDidSpecificSettings with mixin method
await this.$saveUserSettings(this.activeDid, { isRegistered: true });
this.isRegistered = true;
this.notify.success(NOTIFY_INVITE_REGISTRATION_SUCCESS.message);
@@ -900,7 +896,6 @@ export default class ContactsView extends Vue {
text: "Do you want to register them?",
onCancel: async (stopAsking?: boolean) => {
if (stopAsking) {
// Replace databaseUtil.updateDefaultSettings with mixin method
await this.$saveSettings({
hideRegisterPromptOnNewContact: stopAsking,
});
@@ -909,7 +904,6 @@ export default class ContactsView extends Vue {
},
onNo: async (stopAsking?: boolean) => {
if (stopAsking) {
// Replace databaseUtil.updateDefaultSettings with mixin method
await this.$saveSettings({
hideRegisterPromptOnNewContact: stopAsking,
});
@@ -1128,7 +1122,6 @@ export default class ContactsView extends Vue {
private async toggleShowContactAmounts() {
const newShowValue = !this.showGiveNumbers;
try {
// Replace databaseUtil.updateDefaultSettings with mixin method
await this.$saveSettings({
showContactGivesInline: newShowValue,
});