From 96adf1fa2600a9e31d9494ff48cd6fa09d90ae78 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Thu, 15 Jan 2026 17:28:26 -0500 Subject: [PATCH] Better looking testing dashboard. Still needs work though. It does not scroll correctly. --- src/routes/testing/+page.svelte | 417 ++++++++++++++++++++------------ 1 file changed, 260 insertions(+), 157 deletions(-) diff --git a/src/routes/testing/+page.svelte b/src/routes/testing/+page.svelte index 87a14488..0cd9dbc6 100644 --- a/src/routes/testing/+page.svelte +++ b/src/routes/testing/+page.svelte @@ -2,213 +2,316 @@ import { onMount } from 'svelte'; import { api } from '$lib/api/api'; - import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/stores/ae_stores'; + import { ae_loc, ae_sess, ae_api, slct } from '$lib/stores/ae_stores'; import { get_object } from '$lib/ae_api/api_get_object'; import { post_object } from '$lib/ae_api/api_post_object'; + import { + Database, + Server, + User, + Users, + MapPin, + Contact, + ShieldCheck, + Globe, + RefreshCcw, + Trash2, + Bug, + Zap + } from 'lucide-svelte'; - type key_val = { - [key: string]: any; - }; + // Core Module Imports + import { load_ae_obj_li__account } from '$lib/ae_core/ae_core__account'; + import { load_ae_obj_li__site, lookup_site_domain_v3 } from '$lib/ae_core/ae_core__site'; + import { load_ae_obj_li__person } from '$lib/ae_core/ae_core__person'; + import { load_ae_obj_li__address } from '$lib/ae_core/ae_core__address'; + import { load_ae_obj_li__contact } from '$lib/ae_core/ae_core__contact'; + import { load_ae_obj_li__user } from '$lib/ae_core/ae_core__user'; + import { db_core } from '$lib/ae_core/db_core'; - let v3_test_result: any = $state(null); + let test_result: any = $state(null); let test_fqdn = $state(''); + let db_counts: Record = $state({}); - onMount(() => { - console.log('Testing: +page.svelte'); + onMount(async () => { + console.log('Testing Dashboard: +page.svelte'); + await update_db_counts(); + }); + + async function update_db_counts() { + try { + db_counts = { + user: await db_core.user.count(), + person: await db_core.person.count(), + account: await db_core.account.count(), + address: await db_core.address.count(), + contact: await db_core.contact.count(), + site: await db_core.site.count() + }; + } catch (e) { + console.error('Failed to get DB counts:', e); + } + } + + async function run_test(name: string, test_fn: () => Promise) { + test_result = 'loading...'; + try { + const result = await test_fn(); + test_result = { test: name, timestamp: new Date().toISOString(), result }; + await update_db_counts(); + } catch (error: any) { + test_result = { test: name, error: error.message, details: error }; + } + } + + /** + * SYSTEM & INFRASTRUCTURE TESTS + */ + + const test_site_domain_lookup = () => run_test('Site Domain Lookup', async () => { + const fqdn = test_fqdn || window.location.host; + return await lookup_site_domain_v3({ api_cfg: $ae_api, fqdn, log_lvl: 1 }); + }); + + const test_bootstrap_bypass = () => run_test('Bootstrap Paradox Bypass', async () => { + const stripped_api_cfg = { base_url: $ae_api.base_url, headers: {} }; + const fqdn = test_fqdn || window.location.host; + return await post_object({ + api_cfg: stripped_api_cfg, + endpoint: '/v3/crud/site_domain/search', + headers: { 'x-no-account-id': 'System Test' }, + data: { q: fqdn }, + log_lvl: 1 + }); }); /** - * CORE HELPER TESTS + * CORE MODULE TESTS (V3) */ - async function test_core_get_object() { - console.log('*** test_core_get_object() ***'); - v3_test_result = 'loading...'; - - // Direct call to get_object with minimal params - const result = await get_object({ - api_cfg: $ae_api, - endpoint: '/crud/account/list', - params: { limit: 1 }, - log_lvl: 2 + const test_load_accounts = () => run_test('Load Accounts', async () => { + return await load_ae_obj_li__account({ api_cfg: $ae_api, enabled: 'all', log_lvl: 1 }); + }); + + const test_load_people = () => run_test('Load People (Account)', async () => { + return await load_ae_obj_li__person({ + api_cfg: $ae_api, + for_obj_id: $ae_loc.account_id, + enabled: 'all', + log_lvl: 1 }); + }); - v3_test_result = { - helper: 'get_object', - result: result - }; - } - - async function test_core_post_object_v3_search() { - console.log('*** test_core_post_object_v3_search() ***'); - v3_test_result = 'loading...'; - - // Direct call to post_object for V3 search - const result = await post_object({ - api_cfg: $ae_api, - endpoint: '/v3/crud/event/search', - data: { q: 'Aether' }, - params: { limit: 1 }, - log_lvl: 2 + const test_load_addresses = () => run_test('Load Addresses', async () => { + return await load_ae_obj_li__address({ + api_cfg: $ae_api, + for_obj_id: $ae_loc.account_id, + enabled: 'all', + log_lvl: 1 }); + }); - v3_test_result = { - helper: 'post_object', - result: result - }; - } - - async function test_bootstrap_paradox_bypass() { - console.log('*** test_bootstrap_paradox_bypass() ***'); - v3_test_result = 'loading...'; - - // CRITICAL TEST: Simulate unauthenticated first visit - // We create a STRIPPED api_cfg that has no JWT and no account_id - const stripped_api_cfg = { - base_url: $ae_api.base_url, - headers: {} // NO DEFAULT HEADERS - }; - - const fqdn = test_fqdn || window.location.host; - - const result = await post_object({ - api_cfg: stripped_api_cfg, - endpoint: '/v3/crud/site_domain/search', - headers: { 'x-no-account-id': null }, // Trigger the bypass! - data: { q: fqdn }, - log_lvl: 2 + const test_load_contacts = () => run_test('Load Contacts', async () => { + return await load_ae_obj_li__contact({ + api_cfg: $ae_api, + for_obj_id: $ae_loc.account_id, + enabled: 'all', + log_lvl: 1 }); - - v3_test_result = { - test: 'Bootstrap Paradox Bypass', - api_cfg_used: 'STRIPPED (No default headers)', - fqdn_tested: fqdn, - result: result - }; - } + }); /** - * V3 WRAPPER TESTS + * USER MANAGEMENT & SCOPING TESTS */ - async function test_v3_get_id() { - v3_test_result = 'loading...'; - const result = await api.get_ae_obj_v3({ - api_cfg: $ae_api, - obj_type: 'event', - obj_id: '9dv-IV-iz-LY', - view: 'base', - log_lvl: 1 + const test_load_users_account = () => run_test('Load Users (Account Only)', async () => { + return await load_ae_obj_li__user({ + api_cfg: $ae_api, + for_obj_id: $ae_loc.account_id, + include_global: false, + log_lvl: 1 }); - v3_test_result = result; - } + }); - async function test_v3_get_nested_id() { - v3_test_result = 'loading...'; - const result = await api.get_nested_ae_obj_v3({ - api_cfg: $ae_api, - parent_type: 'event', - parent_id: '9dv-IV-iz-LY', - child_type: 'event_badge', - child_id: 'XHTX-23-20-42', - view: 'base', - log_lvl: 1 + const test_load_users_global = () => run_test('Load Users (Global Only)', async () => { + return await load_ae_obj_li__user({ + api_cfg: $ae_api, + for_obj_id: null, + include_global: true, + log_lvl: 1 }); - v3_test_result = result; - } + }); + + const test_load_users_all = () => run_test('Load Users (All)', async () => { + return await load_ae_obj_li__user({ + api_cfg: $ae_api, + for_obj_id: $ae_loc.account_id, + include_global: true, + log_lvl: 1 + }); + }); /** - * DATA LOADING MODULE TESTS + * LOCAL DATABASE (DEXIE) TESTS */ - import { load_ae_obj_li__account, load_ae_obj_id__account } from '$lib/ae_core/ae_core__account'; - import { load_ae_obj_li__site, load_ae_obj_id__site, lookup_site_domain_v3 } from '$lib/ae_core/ae_core__site'; - async function test_site_domain_load_v3() { - v3_test_result = 'loading...'; - const fqdn = test_fqdn || window.location.host; - const result = await lookup_site_domain_v3({ - api_cfg: $ae_api, - fqdn, - log_lvl: 2 - }); - v3_test_result = result; - } + const clear_local_cache = () => run_test('Clear Local Cache', async () => { + await Promise.all([ + db_core.user.clear(), + db_core.person.clear(), + db_core.account.clear(), + db_core.address.clear(), + db_core.contact.clear(), + db_core.site.clear() + ]); + return 'Local cache cleared successfully'; + }); - async function test_account_v3_load() { - v3_test_result = 'loading...'; - const account_li = await load_ae_obj_li__account({ - api_cfg: $ae_api, - enabled: 'all', - hidden: 'all', - log_lvl: 2 - }); - v3_test_result = account_li; - } -
-
-

Aether - System Testing Dashboard

-

Comprehensive validation for API V3 and Core Helpers

+
+
+
+

+ System Testing +

+

Validation dashboard for Aether Platform V3

+
+
+
+
+ {db_counts.user ?? 0} + Users +
+
+
+ {db_counts.person ?? 0} + People +
+
+ +
+
-
+
-
-
-

Global Parameters

- -
- -
-

Core Helper Verification

-
- - - +
+ +
+
+ +

Environment Config

+
+
+ +
-
-

V3 Wrapper Tests

-
- - +
+ +
+
+ +

Infrastructure

+
+
+ + +
+
+ + +
+
+ +

Core Modules (V3)

+
+
+ + + + +
+
+ + +
+
+ +

User Management Scoping

+
+
+ + + +
-
-

Module Loader Tests

-
- - + +
+
+ +
+

Local Cache Management

+

Wipe local IndexedDB tables for core objects

+
+
-
+ -
-
+
+
-
\ No newline at end of file +