Extract default config to const to avoid duplication

This commit is contained in:
Dannon Baker
2025-11-25 09:46:04 -05:00
parent 2f6b049258
commit 6827d43c1e
+6 -16
View File
@@ -1,8 +1,8 @@
import { vi } from "vitest";
import { ref } from "vue";
// Default mock config values that tests can override
const mockConfig = ref({
// Default mock config values
const defaultConfig = {
allow_local_account_creation: true,
enable_oidc: false,
mailing_join_addr: "",
@@ -14,7 +14,9 @@ const mockConfig = ref({
welcome_url: "",
citation_bibtex: "",
toolbox_auto_sort: false,
});
};
const mockConfig = ref({ ...defaultConfig });
export const useConfig = vi.fn(() => ({
config: mockConfig,
@@ -28,17 +30,5 @@ export function setMockConfig(config: Record<string, any>) {
// Helper function to reset config to defaults
export function resetMockConfig() {
mockConfig.value = {
allow_local_account_creation: true,
enable_oidc: false,
mailing_join_addr: "",
prefer_custos_login: false,
registration_warning_message: "",
server_mail_configured: false,
show_welcome_with_login: false,
terms_url: "",
welcome_url: "",
citation_bibtex: "",
toolbox_auto_sort: false,
};
mockConfig.value = { ...defaultConfig };
}