@jmruthers/pace-core 0.5.68 → 0.5.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DataTable-4IUY7BXB.js → DataTable-MPBSXUC6.js} +5 -6
- package/dist/{PublicLoadingSpinner-DdKXTkCZ.d.ts → PublicLoadingSpinner-BOdyU3u-.d.ts} +1 -1
- package/dist/{chunk-PXWEDX7Y.js → chunk-2ARQW6VX.js} +3 -3
- package/dist/{chunk-MOJXHWDE.js → chunk-6JILXFEA.js} +335 -5
- package/dist/chunk-6JILXFEA.js.map +1 -0
- package/dist/{chunk-D7ARGIA3.js → chunk-6RBH67W7.js} +23 -6
- package/dist/chunk-6RBH67W7.js.map +1 -0
- package/dist/{chunk-ZMS23NS5.js → chunk-FJTAWPAQ.js} +3 -5
- package/dist/{chunk-ZMS23NS5.js.map → chunk-FJTAWPAQ.js.map} +1 -1
- package/dist/{chunk-OPCWH3A4.js → chunk-NO5QHMDX.js} +7 -6
- package/dist/chunk-NO5QHMDX.js.map +1 -0
- package/dist/{chunk-ZPK5656W.js → chunk-O3NWNXDY.js} +4 -5
- package/dist/chunk-O3NWNXDY.js.map +1 -0
- package/dist/{chunk-UYA6U6H7.js → chunk-Q2UP3ZWQ.js} +4 -4
- package/dist/{chunk-KRCRNXPD.js → chunk-RVYGJPOD.js} +79 -18
- package/dist/chunk-RVYGJPOD.js.map +1 -0
- package/dist/{chunk-NN45OBIS.js → chunk-UCMHBF7Y.js} +3 -5
- package/dist/{chunk-NN45OBIS.js.map → chunk-UCMHBF7Y.js.map} +1 -1
- package/dist/{chunk-ZPG4XPV5.js → chunk-V3QO3LL7.js} +5 -7
- package/dist/chunk-V3QO3LL7.js.map +1 -0
- package/dist/{chunk-U6GPOF6J.js → chunk-ZXJGZLLO.js} +17 -17
- package/dist/{chunk-U6GPOF6J.js.map → chunk-ZXJGZLLO.js.map} +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/components.js +8 -9
- package/dist/components.js.map +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +9 -6
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/dist/providers.js +5 -7
- package/dist/rbac/index.js +5 -6
- package/dist/{usePublicRouteParams-CdoFxnJK.d.ts → usePublicRouteParams-Ua1Vz-HG.d.ts} +35 -1
- package/dist/utils.d.ts +4 -1
- package/dist/utils.js +3 -3
- package/docs/DOCUMENTATION_CHECKLIST.md +281 -0
- package/docs/README.md +22 -10
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +1 -1
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +1 -1
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventContextType.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/EventProviderProps.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +2 -2
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACContextType.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RBACProviderProps.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/SwitchProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +39 -14
- package/docs/architecture/services.md +374 -0
- package/docs/best-practices/README.md +1 -1
- package/docs/best-practices/testing.md +1 -1
- package/docs/breaking-changes.md +182 -0
- package/docs/common-patterns.md +445 -0
- package/docs/core-concepts/authentication.md +26 -11
- package/docs/core-concepts/events.md +2 -0
- package/docs/core-concepts/organisations.md +2 -0
- package/docs/core-concepts/permissions.md +2 -0
- package/docs/{INDEX.md → documentation-index.md} +26 -38
- package/docs/faq.md +286 -0
- package/docs/{FILE_REFERENCE_SYSTEM.md → file-reference-system.md} +1 -1
- package/docs/getting-started/installation-guide.md +284 -0
- package/docs/getting-started/quick-start.md +8 -1
- package/docs/implementation-guides/app-layout.md +3 -1
- package/docs/implementation-guides/data-tables.md +2 -0
- package/docs/implementation-guides/dynamic-colors.md +47 -2
- package/docs/implementation-guides/event-theming-summary.md +220 -0
- package/docs/implementation-guides/forms.md +9 -7
- package/docs/implementation-guides/navigation.md +2 -0
- package/docs/migration/service-architecture.md +351 -0
- package/docs/rbac/README-rbac-rls-integration.md +2 -2
- package/docs/rbac/README.md +1 -1
- package/docs/rbac/examples/rbac-rls-integration-example.md +3 -3
- package/docs/rbac/quick-start.md +2 -0
- package/docs/rbac/rbac-rls-integration.md +2 -2
- package/docs/style-guide.md +136 -1
- package/docs/testing/README.md +1 -1
- package/docs/troubleshooting/authentication-issues.md +334 -0
- package/docs/troubleshooting/common-issues.md +2 -0
- package/docs/troubleshooting/styling-issues.md +199 -144
- package/docs/usage.md +23 -2
- package/package.json +1 -1
- package/src/__tests__/{TESTING_GUIDELINES.md → TEST_GUIDE_CURSOR.md} +20 -0
- package/src/__tests__/TEST_GUIDE_HUMAN.md +103 -0
- package/src/__tests__/fixtures/test-data.ts +90 -0
- package/src/__tests__/helpers/__tests__/component-test-utils.test.tsx +260 -0
- package/src/__tests__/helpers/__tests__/optimized-test-setup.test.ts +224 -0
- package/src/__tests__/helpers/__tests__/supabaseMock.test.ts +273 -0
- package/src/__tests__/helpers/__tests__/test-providers.test.tsx +98 -0
- package/src/__tests__/helpers/__tests__/test-utils.test.tsx +436 -0
- package/src/__tests__/helpers/__tests__/timer-utils.test.ts +371 -0
- package/src/__tests__/helpers/component-test-utils.tsx +14 -4
- package/src/__tests__/helpers/optimized-test-setup.ts +68 -0
- package/src/__tests__/helpers/test-providers.tsx +329 -0
- package/src/__tests__/helpers/test-utils.tsx +91 -45
- package/src/__tests__/helpers/timer-utils.ts +71 -0
- package/src/__tests__/hooks/usePermissions.test.ts +1 -5
- package/src/__tests__/integration/UserProfile.test.tsx +1 -5
- package/src/__tests__/rbac/PagePermissionGuard.test.tsx +42 -12
- package/src/__tests__/setup.ts +34 -28
- package/src/components/Alert/Alert.test.tsx +1 -5
- package/src/components/Avatar/Avatar.test.tsx +1 -5
- package/src/components/Button/Button.test.tsx +4 -20
- package/src/components/Card/Card.test.tsx +1 -5
- package/src/components/Checkbox/Checkbox.test.tsx +1 -5
- package/src/components/DataTable/__tests__/DataTable.comprehensive.test.tsx +1 -5
- package/src/components/DataTable/__tests__/DataTable.test.tsx +45 -49
- package/src/components/DataTable/__tests__/DataTableCore.test.tsx +1 -5
- package/src/components/DataTable/__tests__/styles.test.ts +382 -0
- package/src/components/DataTable/context/__tests__/DataTableContext.test.tsx +409 -0
- package/src/components/DataTable/core/__tests__/ActionManager.test.ts +634 -0
- package/src/components/DataTable/core/__tests__/DataManager.test.ts +519 -0
- package/src/components/DataTable/core/__tests__/StateManager.test.ts +714 -0
- package/src/components/DataTable/hooks/__tests__/useDataTableState.test.ts +592 -0
- package/src/components/DataTable/utils/__tests__/exportUtils.test.ts +354 -0
- package/src/components/DataTable/utils/__tests__/hierarchicalUtils.test.ts +539 -0
- package/src/components/Dialog/examples/__tests__/SmartDialogExample.unit.test.tsx +1 -5
- package/src/components/Dialog/utils/__tests__/safeHtml.unit.test.ts +1 -8
- package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +34 -38
- package/src/components/Footer/Footer.test.tsx +1 -5
- package/src/components/Form/Form.test.tsx +22 -35
- package/src/components/Header/Header.test.tsx +1 -9
- package/src/components/InactivityWarningModal/InactivityWarningModal.test.tsx +1 -5
- package/src/components/Input/Input.test.tsx +2 -10
- package/src/components/LoginForm/LoginForm.test.tsx +1 -5
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +24 -24
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.accessibility.test.tsx +1 -6
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.integration.test.tsx +6 -16
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.performance.test.tsx +1 -5
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.rbac.test.tsx +1 -5
- package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +1 -7
- package/src/components/PasswordReset/PasswordChangeForm.test.tsx +1 -9
- package/src/components/PasswordReset/PasswordResetForm.test.tsx +1 -9
- package/src/components/PublicLayout/PublicErrorBoundary.tsx +4 -5
- package/src/components/PublicLayout/PublicPageHeader.tsx +13 -9
- package/src/components/PublicLayout/__tests__/EventLogo.test.tsx +666 -0
- package/src/components/PublicLayout/__tests__/PublicErrorBoundary.test.tsx +457 -0
- package/src/components/PublicLayout/__tests__/PublicLoadingSpinner.test.tsx +393 -0
- package/src/components/PublicLayout/__tests__/PublicPageFooter.test.tsx +351 -0
- package/src/components/PublicLayout/__tests__/PublicPageHeader.test.tsx +374 -0
- package/src/components/PublicLayout/__tests__/PublicPageLayout.test.tsx +388 -0
- package/src/components/Select/Select.bug-test.tsx +69 -0
- package/src/components/Select/Select.refactored.tsx +497 -0
- package/src/components/Select/Select.test.tsx +42 -49
- package/src/components/Select/Select.tsx +5 -2
- package/src/components/Select/hooks.ts +254 -0
- package/src/components/Switch/Switch.test.tsx +1 -5
- package/src/components/Table/__tests__/Table.test.tsx +775 -0
- package/src/components/Toast/Toast.test.tsx +15 -8
- package/src/components/Tooltip/Tooltip.test.tsx +1 -5
- package/src/components/UserMenu/UserMenu.test.tsx +3 -15
- package/src/components/__tests__/FileDisplay.test.tsx +575 -0
- package/src/components/__tests__/FileUpload.test.tsx +446 -0
- package/src/components/__tests__/SuperAdminGuard.test.tsx +422 -354
- package/src/hooks/__tests__/ServiceHooks.test.tsx +613 -0
- package/src/hooks/__tests__/hooks.integration.test.tsx +1 -10
- package/src/hooks/__tests__/useApiFetch.unit.test.ts +10 -14
- package/src/hooks/__tests__/useAppConfig.unit.test.ts +307 -0
- package/src/hooks/__tests__/useComponentPerformance.unit.test.tsx +1 -6
- package/src/hooks/__tests__/useFocusTrap.unit.test.tsx +1 -5
- package/src/hooks/__tests__/useOrganisationPermissions.unit.test.tsx +6 -9
- package/src/hooks/__tests__/usePublicEvent.simple.test.ts +321 -0
- package/src/hooks/__tests__/usePublicEvent.unit.test.ts +583 -0
- package/src/hooks/__tests__/usePublicEventLogo.unit.test.ts +640 -0
- package/src/hooks/__tests__/usePublicRouteParams.unit.test.ts +435 -0
- package/src/hooks/__tests__/useRBAC.unit.test.ts +10 -10
- package/src/hooks/__tests__/useStorage.unit.test.ts +751 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/public/usePublicEvent.ts +30 -9
- package/src/hooks/public/usePublicRouteParams.ts +13 -3
- package/src/hooks/services/useAuth.ts +50 -0
- package/src/hooks/services/useAuthService.ts +30 -0
- package/src/hooks/services/useCurrentEvent.ts +36 -0
- package/src/hooks/services/useCurrentOrganisation.ts +52 -0
- package/src/hooks/services/useEventService.ts +30 -0
- package/src/hooks/services/useInactivityService.ts +30 -0
- package/src/hooks/services/useOrganisationService.ts +30 -0
- package/src/hooks/services/usePermissions.ts +70 -0
- package/src/hooks/services/useRBACService.ts +30 -0
- package/src/hooks/useCounter.test.ts +1 -5
- package/src/hooks/useEventTheme.ts +86 -0
- package/src/hooks/useOrganisationPermissions.test.ts +2 -5
- package/src/hooks/useOrganisationSecurity.test.ts +1 -5
- package/src/hooks/usePermissionCache.test.ts +1 -5
- package/src/hooks/usePermissionCheck.ts +150 -0
- package/src/hooks/useSecureDataAccess.test.ts +1 -5
- package/src/index.ts +1 -0
- package/src/providers/OrganisationProvider.test.tsx +1 -5
- package/src/providers/OrganisationProvider.tsx +56 -4
- package/src/providers/UnifiedAuthProvider.test.tsx +1 -5
- package/src/providers/__tests__/AuthProvider.test.tsx +105 -439
- package/src/providers/__tests__/AuthProvider.test.tsx.backup +771 -0
- package/src/providers/__tests__/EventProvider.test.tsx +211 -110
- package/src/providers/__tests__/EventProvider.test.tsx.backup +824 -0
- package/src/providers/__tests__/InactivityProvider.test.tsx +1 -5
- package/src/providers/__tests__/OrganisationProvider.test.tsx +97 -261
- package/src/providers/__tests__/OrganisationProvider.test.tsx.backup +820 -0
- package/src/providers/__tests__/ServiceProviders.test.tsx +477 -0
- package/src/providers/__tests__/UnifiedAuthProvider.test.tsx +72 -504
- package/src/providers/__tests__/UnifiedAuthProvider.test.tsx.backup +911 -0
- package/src/providers/__tests__/UnifiedAuthProvider.test.tsx.backup2 +166 -0
- package/src/providers/services/AuthServiceProvider.tsx +65 -0
- package/src/providers/services/EventServiceProvider.tsx +83 -0
- package/src/providers/services/InactivityServiceProvider.tsx +83 -0
- package/src/providers/services/OrganisationServiceProvider.tsx +77 -0
- package/src/providers/services/RBACServiceProvider.tsx +79 -0
- package/src/providers/services/UnifiedAuthProvider.tsx +368 -0
- package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +210 -0
- package/src/providers/services/__tests__/UnifiedAuthProvider.integration.test.tsx +269 -0
- package/src/rbac/__tests__/adapters.comprehensive.test.tsx +892 -0
- package/src/rbac/__tests__/engine.comprehensive.test.ts +954 -0
- package/src/rbac/__tests__/integration.authflow.test.tsx +1 -5
- package/src/rbac/__tests__/integration.navigation.test.tsx +1 -4
- package/src/rbac/__tests__/rbac-core.test.tsx +2 -7
- package/src/rbac/__tests__/rbac-functions.test.ts +1 -9
- package/src/rbac/__tests__/rbac-integration.test.ts +1 -9
- package/src/rbac/api.test.ts +1 -9
- package/src/rbac/cache.test.ts +10 -8
- package/src/rbac/cli/__tests__/policy-manager.test.ts +339 -0
- package/src/rbac/components/EnhancedNavigationMenu.test.tsx +1 -5
- package/src/rbac/components/NavigationProvider.test.tsx +1 -5
- package/src/rbac/components/PagePermissionProvider.test.tsx +1 -5
- package/src/rbac/components/SecureDataProvider.test.tsx +1 -5
- package/src/rbac/components/__tests__/NavigationGuard.test.tsx +25 -29
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +27 -30
- package/src/rbac/components/__tests__/PermissionEnforcer.test.tsx +23 -27
- package/src/rbac/components/__tests__/RoleBasedRouter.test.tsx +18 -22
- package/src/rbac/config.test.ts +1 -5
- package/src/rbac/hooks/useCan.test.ts +262 -9
- package/src/rbac/hooks/usePermissions.test.ts +246 -6
- package/src/rbac/hooks/useRBAC.simple.test.ts +1 -5
- package/src/rbac/hooks/useRBAC.test.ts +472 -198
- package/src/rbac/providers/__tests__/RBACProvider.test.tsx +1 -9
- package/src/services/AuthService.ts +416 -0
- package/src/services/EventService.ts +366 -0
- package/src/services/InactivityService.ts +388 -0
- package/src/services/OrganisationService.ts +592 -0
- package/src/services/RBACService.ts +522 -0
- package/src/services/__tests__/AuthService.test.ts +356 -0
- package/src/services/__tests__/BaseService.test.ts +314 -0
- package/src/services/__tests__/EventService.test.ts +489 -0
- package/src/services/__tests__/InactivityService.test.ts +403 -0
- package/src/services/__tests__/OrganisationService.test.ts +660 -0
- package/src/services/__tests__/RBACService.test.ts +492 -0
- package/src/services/base/BaseService.ts +87 -0
- package/src/services/interfaces/IAuthService.ts +39 -0
- package/src/services/interfaces/IEventService.ts +30 -0
- package/src/services/interfaces/IInactivityService.ts +31 -0
- package/src/services/interfaces/IOrganisationService.ts +41 -0
- package/src/services/interfaces/IRBACService.ts +62 -0
- package/src/theming/__tests__/runtime.test.ts +540 -0
- package/src/types/__tests__/file-reference.test.ts +447 -0
- package/src/types/__tests__/organisation.test.ts +1133 -0
- package/src/types/__tests__/theme.test.ts +830 -0
- package/src/types/__tests__/type-validation.test.ts +527 -0
- package/src/utils/__tests__/bundleAnalysis.unit.test.ts +1 -5
- package/src/utils/__tests__/debugLogger.test.ts +417 -0
- package/src/utils/__tests__/deviceFingerprint.unit.test.ts +1 -6
- package/src/utils/__tests__/dynamicUtils.unit.test.ts +1 -5
- package/src/utils/__tests__/lazyLoad.unit.test.tsx +35 -35
- package/src/utils/__tests__/organisationContext.unit.test.ts +1 -5
- package/src/utils/__tests__/performanceBudgets.unit.test.ts +5 -11
- package/src/utils/__tests__/secureErrors.unit.test.ts +1 -6
- package/src/utils/__tests__/secureStorage.unit.test.ts +1 -5
- package/src/utils/__tests__/securityMonitor.unit.test.ts +1 -5
- package/src/utils/__tests__/sessionTracking.unit.test.ts +1 -5
- package/src/utils/appIdResolver.test.ts +6 -10
- package/src/utils/appNameResolver.simple.test.ts +142 -0
- package/src/utils/appNameResolver.test.ts +31 -458
- package/src/utils/appNameResolver.test.ts.backup +494 -0
- package/src/utils/debugLogger.ts +26 -5
- package/src/utils/formatDate.test.ts +1 -5
- package/src/utils/organisationContext.test.ts +1 -5
- package/src/utils/performanceBudgets.ts +3 -4
- package/src/utils/secureDataAccess.test.ts +1 -5
- package/src/utils/storage/__tests__/helpers.unit.test.ts +1 -5
- package/src/validation/__tests__/sqlInjectionProtection.unit.test.ts +1 -5
- package/dist/chunk-D7ARGIA3.js.map +0 -1
- package/dist/chunk-IPCH4YPT.js +0 -315
- package/dist/chunk-IPCH4YPT.js.map +0 -1
- package/dist/chunk-KRCRNXPD.js.map +0 -1
- package/dist/chunk-MOJXHWDE.js.map +0 -1
- package/dist/chunk-OPCWH3A4.js.map +0 -1
- package/dist/chunk-ZPG4XPV5.js.map +0 -1
- package/dist/chunk-ZPK5656W.js.map +0 -1
- package/docs/getting-started/installation.md +0 -269
- package/src/__tests__/REBUILD_PLAN.md +0 -223
- /package/dist/{DataTable-4IUY7BXB.js.map → DataTable-MPBSXUC6.js.map} +0 -0
- /package/dist/{chunk-PXWEDX7Y.js.map → chunk-2ARQW6VX.js.map} +0 -0
- /package/dist/{chunk-UYA6U6H7.js.map → chunk-Q2UP3ZWQ.js.map} +0 -0
|
@@ -1,32 +1,81 @@
|
|
|
1
|
-
# Styling Issues
|
|
1
|
+
# Troubleshooting Styling Issues
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **🎨 Styling Problems?** | [← Back to Troubleshooting](../README.md) | [Troubleshooting Overview](./common-issues.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Quick fixes and solutions for common styling issues with PACE Core components.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- Components render but appear unstyled (no colors, spacing, or typography)
|
|
9
|
-
- Buttons look like plain HTML buttons
|
|
10
|
-
- Cards appear as plain divs
|
|
11
|
-
- Colors like `text-main-900`, `bg-sec-500` don't work
|
|
7
|
+
## 🚨 Most Common Issues
|
|
12
8
|
|
|
13
|
-
###
|
|
14
|
-
**Pace-core components are not being scanned for Tailwind classes during the build process.**
|
|
9
|
+
### Components Appear Unstyled
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
**Symptoms:**
|
|
12
|
+
- Components render without styles
|
|
13
|
+
- Default browser styling appears
|
|
14
|
+
- No colors, spacing, or fonts
|
|
15
|
+
|
|
16
|
+
**Immediate Fix:**
|
|
17
|
+
```tsx
|
|
18
|
+
// ✅ In your entry point (main.tsx or App.tsx)
|
|
19
|
+
import '@jmruthers/pace-core/src/styles/core.css'; // MUST be first
|
|
20
|
+
import './app.css'; // Your app's color palette
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Checklist:**
|
|
24
|
+
- [ ] CSS files imported in correct order (core.css first, then app.css)
|
|
25
|
+
- [ ] Tailwind v4 installed (`npm list tailwindcss`)
|
|
26
|
+
- [ ] Vite configured with pace-core content scanning
|
|
27
|
+
- [ ] Dev server restarted after config changes
|
|
28
|
+
|
|
29
|
+
### Colors Don't Work
|
|
30
|
+
|
|
31
|
+
**Symptoms:**
|
|
32
|
+
- `bg-main-600` shows as gray or doesn't work
|
|
33
|
+
- Tailwind utilities return default colors
|
|
34
|
+
- Theme colors not applied
|
|
35
|
+
|
|
36
|
+
**Fix:**
|
|
37
|
+
```css
|
|
38
|
+
/* src/app.css - MUST contain color palettes */
|
|
39
|
+
@import "tailwindcss";
|
|
40
|
+
|
|
41
|
+
/* Source directives */
|
|
42
|
+
@source "./src/**/*.{js,ts,jsx,tsx}";
|
|
43
|
+
@source "./node_modules/@jmruthers/pace-core/src/**/*.{js,ts,jsx,tsx}";
|
|
44
|
+
|
|
45
|
+
/* Color palettes - REQUIRED */
|
|
46
|
+
@theme static {
|
|
47
|
+
--color-main-50: oklch(0.98 0.003 300);
|
|
48
|
+
--color-main-100: oklch(0.96 0.014 300);
|
|
49
|
+
/* ... continue through 950 for main, sec, acc */
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Tailwind v4 Not Working
|
|
54
|
+
|
|
55
|
+
**Symptoms:**
|
|
56
|
+
- Build errors about Tailwind configuration
|
|
57
|
+
- Styles not generated
|
|
58
|
+
- "Cannot find module '@tailwindcss/vite'"
|
|
59
|
+
|
|
60
|
+
**Fix:**
|
|
61
|
+
```bash
|
|
62
|
+
# Install Tailwind v4 (correct version)
|
|
63
|
+
npm uninstall tailwindcss@^3.0.0
|
|
64
|
+
npm install -D @tailwindcss/vite tailwindcss@^4.0.0
|
|
65
|
+
|
|
66
|
+
# Verify installation
|
|
67
|
+
npm list tailwindcss
|
|
68
|
+
# Should show: tailwindcss@^4.0.0
|
|
69
|
+
```
|
|
18
70
|
|
|
19
71
|
```ts
|
|
20
|
-
// vite.config.ts
|
|
21
|
-
import { defineConfig } from 'vite'
|
|
22
|
-
import react from '@vitejs/plugin-react'
|
|
72
|
+
// vite.config.ts - Required configuration
|
|
23
73
|
import tailwindcss from '@tailwindcss/vite'
|
|
24
74
|
|
|
25
75
|
export default defineConfig({
|
|
26
76
|
plugins: [
|
|
27
77
|
react(),
|
|
28
78
|
tailwindcss({
|
|
29
|
-
// CRITICAL: Include pace-core components for scanning
|
|
30
79
|
content: [
|
|
31
80
|
'./src/**/*.{js,ts,jsx,tsx}',
|
|
32
81
|
'./node_modules/@jmruthers/pace-core/**/*.{js,ts,jsx,tsx}'
|
|
@@ -36,184 +85,190 @@ export default defineConfig({
|
|
|
36
85
|
})
|
|
37
86
|
```
|
|
38
87
|
|
|
39
|
-
###
|
|
40
|
-
1. **Check your Vite config** - Ensure pace-core is included in content array
|
|
41
|
-
2. **Restart dev server** - Configuration changes require a restart
|
|
42
|
-
3. **Test with a simple component**:
|
|
43
|
-
```tsx
|
|
44
|
-
import { Button } from '@jmruthers/pace-core';
|
|
45
|
-
|
|
46
|
-
function Test() {
|
|
47
|
-
return <Button variant="primary">Test</Button>;
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
4. **Check browser dev tools** - Look for missing CSS classes in the computed styles
|
|
88
|
+
### Fonts Not Loading
|
|
51
89
|
|
|
52
|
-
|
|
90
|
+
**Symptoms:**
|
|
91
|
+
- Text appears in system default font
|
|
92
|
+
- Font files not found in network tab
|
|
53
93
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
**Symptoms**: No styles at all, components look completely unstyled
|
|
57
|
-
|
|
58
|
-
**Solution**: Import the CSS file in your main entry point:
|
|
94
|
+
**Fix:**
|
|
59
95
|
```tsx
|
|
60
|
-
//
|
|
96
|
+
// Fonts are included in core.css
|
|
97
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
98
|
+
|
|
99
|
+
// Verify fonts are loading
|
|
61
100
|
import '@jmruthers/pace-core/src/styles/core.css';
|
|
101
|
+
// Check browser DevTools > Network > Font for Georama, Open Sans, Reddit Mono
|
|
62
102
|
```
|
|
63
103
|
|
|
64
|
-
###
|
|
104
|
+
### CSS Conflicts with Existing Styles
|
|
65
105
|
|
|
66
|
-
**Symptoms
|
|
106
|
+
**Symptoms:**
|
|
107
|
+
- PACE Core styles override your custom styles
|
|
108
|
+
- Unexpected styling conflicts
|
|
109
|
+
- Specificity issues
|
|
67
110
|
|
|
68
|
-
**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
111
|
+
**Fix:**
|
|
112
|
+
```css
|
|
113
|
+
/* Use CSS layers to control specificity */
|
|
114
|
+
@layer pace-core, your-app;
|
|
72
115
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
116
|
+
/* Your app styles will take precedence when needed */
|
|
117
|
+
@layer your-app {
|
|
118
|
+
.my-custom-button {
|
|
119
|
+
/* Your styles here */
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
77
123
|
|
|
78
|
-
|
|
124
|
+
## 🔧 Detailed Solutions
|
|
79
125
|
|
|
80
|
-
|
|
126
|
+
### Vite Configuration Issues
|
|
81
127
|
|
|
82
|
-
**
|
|
128
|
+
**Problem:** Tailwind not scanning pace-core source files
|
|
129
|
+
|
|
130
|
+
**Solution:**
|
|
83
131
|
```ts
|
|
84
|
-
// vite.config.ts
|
|
132
|
+
// vite.config.ts - REQUIRED
|
|
133
|
+
import { defineConfig } from 'vite'
|
|
134
|
+
import react from '@vitejs/plugin-react'
|
|
135
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
136
|
+
|
|
85
137
|
export default defineConfig({
|
|
86
138
|
plugins: [
|
|
87
139
|
react(),
|
|
88
140
|
tailwindcss({
|
|
141
|
+
// CRITICAL: Must include pace-core source files
|
|
89
142
|
content: [
|
|
90
143
|
'./src/**/*.{js,ts,jsx,tsx}',
|
|
91
|
-
'./node_modules/@jmruthers/pace-core/**/*.{js,ts,jsx,tsx}'
|
|
144
|
+
'./node_modules/@jmruthers/pace-core/src/**/*.{js,ts,jsx,tsx}',
|
|
145
|
+
'./node_modules/@jmruthers/pace-core/src/components/**/*.{js,ts,jsx,tsx}',
|
|
146
|
+
'./node_modules/@jmruthers/pace-core/src/providers/**/*.{js,ts,jsx,tsx}'
|
|
92
147
|
]
|
|
93
148
|
})
|
|
94
149
|
],
|
|
95
|
-
build: {
|
|
96
|
-
// Your build config
|
|
97
|
-
}
|
|
98
150
|
})
|
|
99
151
|
```
|
|
100
152
|
|
|
101
|
-
###
|
|
153
|
+
### Import Order Issues
|
|
102
154
|
|
|
103
|
-
**
|
|
155
|
+
**Problem:** Styles not applied due to import order
|
|
104
156
|
|
|
105
|
-
**Solution
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
]
|
|
111
|
-
```
|
|
157
|
+
**Solution:**
|
|
158
|
+
```tsx
|
|
159
|
+
// ✅ CORRECT ORDER
|
|
160
|
+
// 1. Import core.css first
|
|
161
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
112
162
|
|
|
113
|
-
|
|
163
|
+
// 2. Import your app.css second
|
|
164
|
+
import './app.css';
|
|
114
165
|
|
|
115
|
-
|
|
166
|
+
// 3. Import your other styles
|
|
167
|
+
import './index.css';
|
|
116
168
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
169
|
+
// ❌ WRONG ORDER
|
|
170
|
+
import './app.css';
|
|
171
|
+
import '@jmruthers/pace-core/src/styles/core.css'; // Too late!
|
|
172
|
+
```
|
|
121
173
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
174
|
+
### Missing Color Palette
|
|
175
|
+
|
|
176
|
+
**Problem:** Error or gray colors because color palette not defined
|
|
177
|
+
|
|
178
|
+
**Complete app.css Template:**
|
|
179
|
+
```css
|
|
180
|
+
/* src/app.css */
|
|
181
|
+
@import "tailwindcss";
|
|
182
|
+
|
|
183
|
+
/* Source directives for scanning */
|
|
184
|
+
@source "./src/**/*.{js,ts,jsx,tsx}";
|
|
185
|
+
@source "./node_modules/@jmruthers/pace-core/src/**/*.{js,ts,jsx,tsx}";
|
|
186
|
+
|
|
187
|
+
/* Main palette - Primary brand color */
|
|
188
|
+
@theme static {
|
|
189
|
+
--color-main-50: oklch(0.98 0.003 300);
|
|
190
|
+
--color-main-100: oklch(0.96 0.014 300);
|
|
191
|
+
--color-main-200: oklch(0.927 0.033 300);
|
|
192
|
+
--color-main-300: oklch(0.881 0.059 300);
|
|
193
|
+
--color-main-400: oklch(0.822 0.093 300);
|
|
194
|
+
--color-main-500: oklch(0.75 0.133 300);
|
|
195
|
+
--color-main-600: oklch(0.665 0.182 300);
|
|
196
|
+
--color-main-700: oklch(0.58 0.23 300);
|
|
197
|
+
--color-main-800: oklch(0.456 0.158 300);
|
|
198
|
+
--color-main-900: oklch(0.332 0.099 300);
|
|
199
|
+
--color-main-950: oklch(0.195 0.047 300);
|
|
200
|
+
|
|
201
|
+
/* Secondary palette */
|
|
202
|
+
--color-sec-50: oklch(0.98 0.003 244.75);
|
|
203
|
+
/* ... continue through 950 */
|
|
204
|
+
|
|
205
|
+
/* Accent palette */
|
|
206
|
+
--color-acc-50: oklch(0.98 0.003 7.385);
|
|
207
|
+
/* ... continue through 950 */
|
|
208
|
+
}
|
|
209
|
+
```
|
|
136
210
|
|
|
137
|
-
##
|
|
211
|
+
## 🧪 Verification Steps
|
|
138
212
|
|
|
139
|
-
### Check
|
|
213
|
+
### 1. Check Imports
|
|
140
214
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
content: [
|
|
146
|
-
'./src/**/*.{js,ts,jsx,tsx}',
|
|
147
|
-
'./node_modules/@jmruthers/pace-core/**/*.{js,ts,jsx,tsx}'
|
|
148
|
-
],
|
|
149
|
-
debug: true // Add this for debugging
|
|
150
|
-
})
|
|
151
|
-
```
|
|
215
|
+
```tsx
|
|
216
|
+
// Add to your entry file to verify
|
|
217
|
+
console.log('✅ CSS imports working');
|
|
218
|
+
```
|
|
152
219
|
|
|
153
|
-
2.
|
|
220
|
+
### 2. Inspect Generated CSS
|
|
154
221
|
|
|
155
|
-
|
|
222
|
+
Open browser DevTools > Elements > Styles tab
|
|
223
|
+
- Should see Tailwind utility classes
|
|
224
|
+
- Colors should show oklch() values
|
|
225
|
+
- Component styles should be present
|
|
156
226
|
|
|
157
|
-
###
|
|
227
|
+
### 3. Test Basic Component
|
|
158
228
|
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
|
|
229
|
+
```tsx
|
|
230
|
+
import { Button } from '@jmruthers/pace-core';
|
|
231
|
+
|
|
232
|
+
function Test() {
|
|
233
|
+
return <Button>Test Button</Button>;
|
|
234
|
+
}
|
|
162
235
|
|
|
163
|
-
|
|
236
|
+
// Should render with proper PACE Core styling
|
|
237
|
+
// Not unstyled or default browser styling
|
|
164
238
|
```
|
|
165
239
|
|
|
166
|
-
|
|
240
|
+
## 🐛 Debug Commands
|
|
167
241
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
242
|
+
```bash
|
|
243
|
+
# Check Tailwind version
|
|
244
|
+
npm list tailwindcss
|
|
171
245
|
|
|
172
|
-
|
|
246
|
+
# Check if pace-core installed
|
|
247
|
+
npm list @jmruthers/pace-core
|
|
173
248
|
|
|
174
|
-
|
|
249
|
+
# Verify Vite configuration
|
|
250
|
+
npx vite --config vite.config.ts --debug
|
|
175
251
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
export default defineConfig({
|
|
179
|
-
plugins: [
|
|
180
|
-
react(),
|
|
181
|
-
tailwindcss({
|
|
182
|
-
content: {
|
|
183
|
-
files: [
|
|
184
|
-
'./src/**/*.{js,ts,jsx,tsx}',
|
|
185
|
-
'./node_modules/@jmruthers/pace-core/**/*.{js,ts,jsx,tsx}',
|
|
186
|
-
'./node_modules/@jmruthers/pace-core/dist/**/*.{js,ts,jsx,tsx}'
|
|
187
|
-
]
|
|
188
|
-
}
|
|
189
|
-
})
|
|
190
|
-
],
|
|
191
|
-
})
|
|
252
|
+
# Build and check for errors
|
|
253
|
+
npm run build
|
|
192
254
|
```
|
|
193
255
|
|
|
194
|
-
##
|
|
195
|
-
|
|
196
|
-
Before asking for help, verify:
|
|
256
|
+
## 📚 Related Documentation
|
|
197
257
|
|
|
198
|
-
- [ ]
|
|
199
|
-
- [ ]
|
|
200
|
-
- [ ]
|
|
201
|
-
- [ ]
|
|
202
|
-
- [ ] All required peer dependencies installed
|
|
203
|
-
- [ ] Test component renders with proper styling
|
|
258
|
+
- [Styling Overview](../styles/README.md) - Complete styling guide
|
|
259
|
+
- [Installation Guide](../getting-started/installation-guide.md) - Setup instructions
|
|
260
|
+
- [Vite Configuration](../consuming-app-vite-config.md) - Critical setup
|
|
261
|
+
- [Common Issues](./common-issues.md) - Other troubleshooting
|
|
204
262
|
|
|
205
|
-
## 🆘 Still
|
|
263
|
+
## 🆘 Still Not Working?
|
|
206
264
|
|
|
207
|
-
If you've tried
|
|
265
|
+
If you've tried everything above and still have issues:
|
|
208
266
|
|
|
209
|
-
1. **
|
|
210
|
-
2. **
|
|
211
|
-
3. **
|
|
212
|
-
4. **
|
|
267
|
+
1. **Create a minimal test case** showing the problem
|
|
268
|
+
2. **Gather debug info** using the commands above
|
|
269
|
+
3. **Check browser console** for error messages
|
|
270
|
+
4. **File an issue** with your findings
|
|
213
271
|
|
|
214
|
-
|
|
272
|
+
---
|
|
215
273
|
|
|
216
|
-
|
|
217
|
-
- [Vite Configuration](../consuming-app-vite-config.md) - Detailed Vite setup
|
|
218
|
-
- [Quick Start Guide](../getting-started/quick-start.md) - Step-by-step tutorial
|
|
219
|
-
- [Styles Guide](../styles/README.md) - Understanding the styling system
|
|
274
|
+
**Last Updated:** 2025-01-XX | **Version:** v0.5.65+
|
package/docs/usage.md
CHANGED
|
@@ -73,9 +73,30 @@ function MyComponent() {
|
|
|
73
73
|
|
|
74
74
|
## Dynamic Theming
|
|
75
75
|
|
|
76
|
-
###
|
|
76
|
+
### Automatic Event Theming (Recommended)
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
If your app uses the `EventProvider`, simply call `useEventTheme()`:
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import { useEventTheme } from '@jmruthers/pace-core';
|
|
82
|
+
|
|
83
|
+
function MyApp() {
|
|
84
|
+
// Automatically applies event colors when an event is selected
|
|
85
|
+
useEventTheme();
|
|
86
|
+
|
|
87
|
+
return <div>Your app</div>;
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
This hook automatically:
|
|
92
|
+
- Applies event colors when an event is selected
|
|
93
|
+
- Clears theming when no event is selected
|
|
94
|
+
- Handles cleanup and error cases
|
|
95
|
+
- Works consistently across all apps
|
|
96
|
+
|
|
97
|
+
### Manual Organisation/Event Colors
|
|
98
|
+
|
|
99
|
+
For custom logic or organisation-based theming:
|
|
79
100
|
|
|
80
101
|
```tsx
|
|
81
102
|
import { applyPalette, clearPalette } from '@jmruthers/pace-core/theming/runtime';
|
package/package.json
CHANGED
|
@@ -293,6 +293,26 @@ screen.getByLabelText('Email address');
|
|
|
293
293
|
- ❌ Configuration files
|
|
294
294
|
- ❌ Type definitions
|
|
295
295
|
|
|
296
|
+
## 🧩 Test Expansion Workflow
|
|
297
|
+
|
|
298
|
+
When expanding test coverage:
|
|
299
|
+
|
|
300
|
+
1. **Start with the coverage report** (`npm test -- --coverage`)
|
|
301
|
+
2. Identify high-priority or under-tested modules
|
|
302
|
+
3. Choose the appropriate test type (unit, component, integration)
|
|
303
|
+
4. Use our standard structure and semantic queries
|
|
304
|
+
5. Assert observable behaviour (not internal state or styles)
|
|
305
|
+
6. Use test tags (`[unit]`, `[integration]`, etc.) for discoverability
|
|
306
|
+
|
|
307
|
+
## ✅ Pre-Merge Test Checklist
|
|
308
|
+
|
|
309
|
+
- [ ] Are all tests passing (no `it.only` or `test.skip`)?
|
|
310
|
+
- [ ] Are coverage thresholds still met?
|
|
311
|
+
- [ ] Are tests colocated with the source?
|
|
312
|
+
- [ ] Are semantic queries used (no test IDs)?
|
|
313
|
+
- [ ] Is global state cleaned up properly?
|
|
314
|
+
- [ ] Are new utilities or hooks covered with tests?
|
|
315
|
+
|
|
296
316
|
## 🚀 Running Tests
|
|
297
317
|
|
|
298
318
|
### Commands
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
|
|
2
|
+
# 🎯 Cursor-Friendly Testing Guide (pace-core)
|
|
3
|
+
|
|
4
|
+
This is a simplified version of our full `TESTING_GUIDELINES.md`, designed for use by Cursor or other automated tools.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## ✅ Testing Principles (Keep It Simple)
|
|
9
|
+
|
|
10
|
+
- Test observable behaviour, not internal state or styling
|
|
11
|
+
- Prefer unit/component tests; use integration tests only where needed
|
|
12
|
+
- Avoid brittle selectors and over-mocking
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 🧪 Preferred Patterns
|
|
17
|
+
|
|
18
|
+
### Semantic Queries
|
|
19
|
+
Use these in place of test IDs or class names:
|
|
20
|
+
```ts
|
|
21
|
+
getByRole, getByText, getByLabelText, findByText
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Hook Testing
|
|
25
|
+
```ts
|
|
26
|
+
const { result } = renderHook(() => useCustomHook());
|
|
27
|
+
expect(result.current.value).toBe('expected');
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Component Testing
|
|
31
|
+
```ts
|
|
32
|
+
describe('MyComponent', () => {
|
|
33
|
+
it('renders correctly', () => {
|
|
34
|
+
render(<MyComponent />);
|
|
35
|
+
expect(screen.getByRole('heading')).toHaveTextContent('Title');
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Async Behaviour
|
|
41
|
+
```ts
|
|
42
|
+
const button = await screen.findByRole('button');
|
|
43
|
+
await user.click(button);
|
|
44
|
+
expect(await screen.findByText('Submitted')).toBeInTheDocument();
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## ♻️ Structure & Naming
|
|
50
|
+
|
|
51
|
+
- Test files should be colocated: `MyComponent.test.tsx`, `useThing.test.ts`
|
|
52
|
+
- Use structured `describe` blocks for clarity:
|
|
53
|
+
```ts
|
|
54
|
+
describe('ComponentName', () => {
|
|
55
|
+
describe('Rendering', () => {});
|
|
56
|
+
describe('User Interactions', () => {});
|
|
57
|
+
describe('Error Handling', () => {});
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 🔧 Mocking & Cleanup
|
|
64
|
+
|
|
65
|
+
### Mocks
|
|
66
|
+
```ts
|
|
67
|
+
vi.mock('module', () => ({
|
|
68
|
+
myFn: vi.fn(),
|
|
69
|
+
}));
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Cleanup
|
|
73
|
+
```ts
|
|
74
|
+
afterEach(() => {
|
|
75
|
+
cleanup();
|
|
76
|
+
vi.clearAllMocks();
|
|
77
|
+
vi.useRealTimers();
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 📊 Coverage Targets
|
|
84
|
+
|
|
85
|
+
- Utils/Hooks: ≥ 95%
|
|
86
|
+
- UI Components: ≥ 90%
|
|
87
|
+
- Feature Modules: ≥ 85%
|
|
88
|
+
- Overall Project: ≥ 82%
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 🚫 Avoid
|
|
93
|
+
|
|
94
|
+
- `getByTestId`, `getByClassName`, DOM structure assertions
|
|
95
|
+
- Snapshot tests (unless explicitly stable)
|
|
96
|
+
- Global state leaks (unreset between tests)
|
|
97
|
+
- Asserting internal state or props
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 🧠 Remember
|
|
102
|
+
|
|
103
|
+
Tests should be readable, behavioural, isolated, and maintainable.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Test Data Fixtures
|
|
3
|
+
* @description Shared test data to reduce generation overhead
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { vi } from 'vitest';
|
|
7
|
+
|
|
8
|
+
// Pre-generated test data to avoid repeated object creation
|
|
9
|
+
export const TEST_FIXTURES = {
|
|
10
|
+
users: {
|
|
11
|
+
basic: {
|
|
12
|
+
id: 'test-user-id',
|
|
13
|
+
email: 'test@example.com',
|
|
14
|
+
name: 'Test User',
|
|
15
|
+
created_at: '2023-01-01T00:00:00Z',
|
|
16
|
+
},
|
|
17
|
+
admin: {
|
|
18
|
+
id: 'admin-user-id',
|
|
19
|
+
email: 'admin@example.com',
|
|
20
|
+
name: 'Admin User',
|
|
21
|
+
role: 'admin',
|
|
22
|
+
created_at: '2023-01-01T00:00:00Z',
|
|
23
|
+
},
|
|
24
|
+
superAdmin: {
|
|
25
|
+
id: 'super-admin-id',
|
|
26
|
+
email: 'superadmin@example.com',
|
|
27
|
+
name: 'Super Admin',
|
|
28
|
+
role: 'super_admin',
|
|
29
|
+
created_at: '2023-01-01T00:00:00Z',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
organisations: {
|
|
34
|
+
basic: {
|
|
35
|
+
id: 'org-123',
|
|
36
|
+
name: 'Test Organisation',
|
|
37
|
+
slug: 'test-org',
|
|
38
|
+
created_at: '2023-01-01T00:00:00Z',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
events: {
|
|
43
|
+
basic: {
|
|
44
|
+
id: 'event-123',
|
|
45
|
+
name: 'Test Event',
|
|
46
|
+
code: 'TEST123',
|
|
47
|
+
organisation_id: 'org-123',
|
|
48
|
+
created_at: '2023-01-01T00:00:00Z',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
permissions: {
|
|
53
|
+
read: 'read:users',
|
|
54
|
+
write: 'write:users',
|
|
55
|
+
delete: 'delete:users',
|
|
56
|
+
admin: 'admin:organisation',
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
mockFunctions: {
|
|
60
|
+
onClick: vi.fn(),
|
|
61
|
+
onSubmit: vi.fn(),
|
|
62
|
+
onError: vi.fn(),
|
|
63
|
+
onSuccess: vi.fn(),
|
|
64
|
+
},
|
|
65
|
+
} as const;
|
|
66
|
+
|
|
67
|
+
// Helper to create variations of fixtures
|
|
68
|
+
export const createFixture = <T extends Record<string, any>>(
|
|
69
|
+
base: T,
|
|
70
|
+
overrides: Partial<T> = {}
|
|
71
|
+
): T => ({ ...base, ...overrides });
|
|
72
|
+
|
|
73
|
+
// Pre-generated arrays for bulk testing
|
|
74
|
+
export const BULK_FIXTURES = {
|
|
75
|
+
users: Array.from({ length: 10 }, (_, i) => ({
|
|
76
|
+
...TEST_FIXTURES.users.basic,
|
|
77
|
+
id: `user-${i}`,
|
|
78
|
+
email: `user${i}@example.com`,
|
|
79
|
+
name: `User ${i}`,
|
|
80
|
+
})),
|
|
81
|
+
|
|
82
|
+
permissions: [
|
|
83
|
+
'read:users',
|
|
84
|
+
'write:users',
|
|
85
|
+
'delete:users',
|
|
86
|
+
'read:events',
|
|
87
|
+
'write:events',
|
|
88
|
+
'admin:organisation',
|
|
89
|
+
],
|
|
90
|
+
} as const;
|