Skip to content

Commit c0d87d9

Browse files
Copilothotlong
andcommitted
test: add integration test verifying EditAppPage merge preserves original app fields
Enhances the mock wizard onComplete to include icon field (matching real wizard behavior) and adds a dedicated test verifying: - label, icon, branding are present in saved schema (from wizard) - active is preserved from original app config (not in wizard) Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent a2f9cf6 commit c0d87d9

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

ROADMAP.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ ObjectUI is a universal Server-Driven UI (SDUI) engine built on React + Tailwind
502502
- [x] 23 PageCanvasEditor tests (rendering, add/remove components, property panel, read-only, mode tabs, undo/redo, export/import, preview mode)
503503
- [x] 12 ObjectViewConfigurator tests (rendering, view type switch, column visibility, toggles, read-only)
504504
- [x] 29 BrandingEditor tests (rendering, editing, light/dark preview, read-only, undo/redo, export/import, keyboard shortcuts, preview content)
505-
- [x] **Total: 237 tests across 10 files, all passing**
505+
- [x] **Total: 238 tests across 10 files, all passing**
506506

507507
**ComponentRegistry:**
508508
- [x] Registered: `app-creation-wizard`, `navigation-designer`, `dashboard-editor`, `page-canvas-editor`, `object-view-configurator`, `branding-editor`
@@ -531,12 +531,13 @@ ObjectUI is a universal Server-Driven UI (SDUI) engine built on React + Tailwind
531531
- [x] AppSidebar "Edit App" button → navigates to `/edit-app/:appName`
532532
- [x] CommandPalette "Create New App" command (⌘+K → Actions group)
533533
- [x] Empty state CTA "Create Your First App" when no apps configured
534-
- [x] `wizardDraftToAppSchema()` conversion on completion
534+
- [x] `wizardDraftToAppSchema()` conversion on completion — includes `icon`, `label`, `branding` fields
535+
- [x] `EditAppPage` merges wizard output with original app config to preserve fields not in wizard (e.g. `active`)
535536
- [x] `client.meta.saveItem('app', name, schema)` — persists app metadata to backend on create/edit
536537
- [x] MSW PUT handler for `/meta/:type/:name` — dev/mock mode metadata persistence
537538
- [x] Draft persistence to localStorage with auto-clear on success
538539
- [x] `createApp` i18n key added to all 10 locales
539-
- [x] 13 console integration tests (routes, wizard callbacks, draft persistence, saveItem, CommandPalette)
540+
- [x] 14 console integration tests (routes, wizard callbacks, draft persistence, saveItem, merge preservation, CommandPalette)
540541

541542
### P1.12 System Settings & App Management Center
542543

apps/console/src/__tests__/app-creation-integration.test.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ vi.mock('@object-ui/plugin-designer', () => ({
135135
<div data-testid="app-creation-wizard">
136136
<span data-testid="wizard-objects-count">{availableObjects?.length ?? 0}</span>
137137
{initialDraft?.name && <span data-testid="wizard-initial-name">{initialDraft.name}</span>}
138-
<button data-testid="wizard-complete" onClick={() => onComplete?.({ name: 'my_app', title: 'My App', branding: { logo: '', primaryColor: '#000', favicon: '' }, objects: [], navigation: [], layout: 'sidebar' })}>
138+
<button data-testid="wizard-complete" onClick={() => onComplete?.({ name: 'my_app', title: 'My App', icon: 'LayoutDashboard', branding: { logo: '', primaryColor: '#000', favicon: '' }, objects: [], navigation: [], layout: 'sidebar' })}>
139139
Complete
140140
</button>
141141
<button data-testid="wizard-cancel" onClick={() => onCancel?.()}>
@@ -424,6 +424,27 @@ describe('Console App Creation Integration', () => {
424424
);
425425
});
426426
});
427+
428+
it('preserves original app fields not managed by wizard after merge', async () => {
429+
renderApp('/apps/sales/edit-app/sales');
430+
431+
await waitFor(() => {
432+
expect(screen.getByTestId('wizard-complete')).toBeInTheDocument();
433+
}, { timeout: 10000 });
434+
435+
fireEvent.click(screen.getByTestId('wizard-complete'));
436+
437+
await waitFor(() => {
438+
const client = MockAdapterInstance.getClient();
439+
const savedSchema = client.meta.saveItem.mock.calls[0]?.[2];
440+
// Wizard-generated fields are present
441+
expect(savedSchema.label).toBe('My App');
442+
expect(savedSchema.icon).toBe('LayoutDashboard');
443+
expect(savedSchema.branding).toEqual({ logo: '', primaryColor: '#000', favicon: '' });
444+
// Original app field not in wizard is preserved via merge
445+
expect(savedSchema.active).toBe(true);
446+
});
447+
});
427448
});
428449

429450
// --- CommandPalette: Create App Command ---

0 commit comments

Comments
 (0)