@wopr-network/platform-ui-core 1.27.7 → 1.27.9
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/next.config.ts +1 -2
- package/package.json +17 -17
- package/src/__tests__/account-switcher.test.tsx +21 -20
- package/src/__tests__/activity-page.test.tsx +2 -6
- package/src/__tests__/add-payment-method-dialog.test.tsx +9 -32
- package/src/__tests__/admin-api.test.ts +1 -6
- package/src/__tests__/admin-gpu-api.test.ts +1 -3
- package/src/__tests__/admin-marketplace-api.test.ts +1 -4
- package/src/__tests__/admin-middleware.test.ts +76 -83
- package/src/__tests__/affiliate-dashboard.test.tsx +3 -3
- package/src/__tests__/api-401-redirect.test.ts +46 -9
- package/src/__tests__/api-client.test.ts +3 -5
- package/src/__tests__/api-config.test.ts +22 -42
- package/src/__tests__/api-fleet-resources.test.ts +1 -2
- package/src/__tests__/api-fleet-trpc.test.ts +2 -8
- package/src/__tests__/api-null-guards.test.ts +3 -1
- package/src/__tests__/audit-log-table-pagination.test.tsx +2 -6
- package/src/__tests__/auth-password-reset.test.tsx +7 -21
- package/src/__tests__/auth-redirect.test.tsx +8 -2
- package/src/__tests__/auth.test.tsx +25 -23
- package/src/__tests__/auto-topup-card.test.tsx +4 -12
- package/src/__tests__/backups-tab.test.tsx +3 -4
- package/src/__tests__/billing-layout-nav-hidden.test.tsx +5 -37
- package/src/__tests__/billing-payment-org-invoices.test.tsx +2 -18
- package/src/__tests__/billing.test.tsx +8 -39
- package/src/__tests__/bot-settings/resources-tab.test.tsx +1 -3
- package/src/__tests__/bot-settings/storage-tab.test.tsx +1 -3
- package/src/__tests__/bot-settings/vps-upgrade-card.test.tsx +1 -3
- package/src/__tests__/bot-settings-restart.test.tsx +1 -3
- package/src/__tests__/bot-settings.test.tsx +2 -6
- package/src/__tests__/brand.test.ts +6 -26
- package/src/__tests__/buy-credits-panel.test.tsx +1 -3
- package/src/__tests__/buy-crypto-credits-panel.test.tsx +101 -119
- package/src/__tests__/capability-conflicts.test.ts +2 -8
- package/src/__tests__/capability-resolver.test.tsx +2 -12
- package/src/__tests__/channel-wizard.test.tsx +4 -17
- package/src/__tests__/chat/chat-panel.test.tsx +1 -4
- package/src/__tests__/chat-store.test.ts +5 -15
- package/src/__tests__/command-center.test.tsx +10 -12
- package/src/__tests__/compliance-retention-edit.test.tsx +3 -6
- package/src/__tests__/confirmation-tracker.test.tsx +3 -18
- package/src/__tests__/coupon-input.test.tsx +1 -3
- package/src/__tests__/create-instance.test.tsx +1 -3
- package/src/__tests__/credit-balance.test.tsx +4 -12
- package/src/__tests__/credits.test.tsx +32 -85
- package/src/__tests__/email-verification-banner.test.tsx +2 -6
- package/src/__tests__/error-boundaries.test.tsx +0 -1
- package/src/__tests__/fetch-pricing.test.ts +2 -1
- package/src/__tests__/field-oauth.test.tsx +2 -6
- package/src/__tests__/fixtures/mock-manifests-data.js +1 -3
- package/src/__tests__/fixtures/mock-manifests.ts +2 -4
- package/src/__tests__/fleet-health-timestamp.test.tsx +1 -8
- package/src/__tests__/fleet-health-update.test.tsx +1 -8
- package/src/__tests__/gpu-dashboard.test.tsx +2 -6
- package/src/__tests__/instance-detail.test.tsx +3 -9
- package/src/__tests__/instance-list.test.tsx +1 -5
- package/src/__tests__/layout-snapshots.test.tsx +64 -11
- package/src/__tests__/marketplace-admin.test.tsx +2 -6
- package/src/__tests__/marketplace.test.tsx +11 -35
- package/src/__tests__/merge-api-rates.test.ts +1 -6
- package/src/__tests__/middleware.test.ts +32 -219
- package/src/__tests__/next-config-headers.test.ts +1 -3
- package/src/__tests__/notifications.test.tsx +4 -11
- package/src/__tests__/oauth-buttons.test.tsx +36 -59
- package/src/__tests__/oauth-error-mapping.test.tsx +2 -6
- package/src/__tests__/observability.test.tsx +23 -36
- package/src/__tests__/onboarding-page.test.tsx +4 -6
- package/src/__tests__/org-billing-api.test.tsx +1 -6
- package/src/__tests__/plugin-install-flow.test.tsx +28 -58
- package/src/__tests__/plugin-registry.test.tsx +3 -11
- package/src/__tests__/plugin-tool-sync.test.ts +1 -3
- package/src/__tests__/plugins-catalog-error.test.tsx +2 -6
- package/src/__tests__/plugins-toggle-race.test.tsx +3 -5
- package/src/__tests__/portfolio-chart.test.tsx +2 -6
- package/src/__tests__/promotion-form.test.tsx +2 -6
- package/src/__tests__/promotions-list.test.tsx +1 -3
- package/src/__tests__/provider-key-api.test.ts +2 -1
- package/src/__tests__/resend-verification-button.test.tsx +8 -24
- package/src/__tests__/secrets-audit-pagination.test.tsx +1 -3
- package/src/__tests__/settings.test.tsx +11 -21
- package/src/__tests__/setup-checklist.test.tsx +3 -9
- package/src/__tests__/setup.ts +25 -6
- package/src/__tests__/snapshot-api.test.ts +2 -1
- package/src/__tests__/step-superpowers.test.tsx +1 -3
- package/src/__tests__/tenant-context.test.tsx +1 -6
- package/src/__tests__/tenant-keys-api.test.ts +3 -4
- package/src/__tests__/tenant-table-pagination.test.tsx +2 -6
- package/src/__tests__/terminal-log-cleanup.test.tsx +0 -1
- package/src/__tests__/transaction-history.test.tsx +190 -238
- package/src/__tests__/trpc-types.test.ts +2 -6
- package/src/__tests__/use-chat.test.ts +1 -3
- package/src/__tests__/use-plugin-setup-chat-stale-closure.test.ts +1 -4
- package/src/__tests__/use-sidecar-bridge.test.tsx +105 -0
- package/src/__tests__/use-webmcp.test.ts +1 -3
- package/src/__tests__/validate-elevenlabs-key.test.ts +2 -1
- package/src/__tests__/verify-page.test.tsx +4 -13
- package/src/__tests__/verify-redirect.test.tsx +2 -6
- package/src/app/(auth)/error.tsx +1 -7
- package/src/app/(auth)/forgot-password/page.tsx +4 -18
- package/src/app/(auth)/login/page.tsx +5 -22
- package/src/app/(auth)/reset-password/page.tsx +2 -12
- package/src/app/(auth)/signup/page.tsx +10 -44
- package/src/app/(auth)/verify/page.tsx +47 -0
- package/src/app/(dashboard)/billing/credits/page.tsx +14 -67
- package/src/app/(dashboard)/billing/error.tsx +2 -10
- package/src/app/(dashboard)/billing/layout.tsx +12 -62
- package/src/app/(dashboard)/billing/payment/page.tsx +17 -68
- package/src/app/(dashboard)/billing/plans/page.tsx +3 -9
- package/src/app/(dashboard)/billing/usage/hosted/page.tsx +8 -25
- package/src/app/(dashboard)/billing/usage/page.tsx +63 -103
- package/src/app/(dashboard)/changesets/[id]/changeset-detail-client.tsx +9 -27
- package/src/app/(dashboard)/changesets/[id]/error.tsx +2 -6
- package/src/app/(dashboard)/changesets/error.tsx +1 -7
- package/src/app/(dashboard)/chat/page.tsx +2 -6
- package/src/app/(dashboard)/dashboard/network/page.tsx +5 -19
- package/src/app/(dashboard)/error.tsx +1 -7
- package/src/app/(dashboard)/layout.tsx +15 -36
- package/src/app/(dashboard)/marketplace/[plugin]/page.tsx +14 -51
- package/src/app/(dashboard)/marketplace/error.tsx +1 -7
- package/src/app/(dashboard)/marketplace/page.tsx +6 -27
- package/src/app/(dashboard)/not-found.tsx +2 -5
- package/src/app/(dashboard)/onboarding/page.tsx +5 -22
- package/src/app/(dashboard)/settings/account/page.tsx +1 -6
- package/src/app/(dashboard)/settings/activity/page.tsx +8 -34
- package/src/app/(dashboard)/settings/api-keys/page.tsx +15 -60
- package/src/app/(dashboard)/settings/brain/page.tsx +9 -31
- package/src/app/(dashboard)/settings/error.tsx +2 -10
- package/src/app/(dashboard)/settings/notifications/page.tsx +2 -6
- package/src/app/(dashboard)/settings/org/page.tsx +13 -56
- package/src/app/(dashboard)/settings/page.tsx +1 -0
- package/src/app/(dashboard)/settings/profile/page.tsx +126 -73
- package/src/app/(dashboard)/settings/providers/page.tsx +21 -78
- package/src/app/(dashboard)/settings/secrets/page.tsx +13 -58
- package/src/app/(dashboard)/settings/security/page.tsx +31 -111
- package/src/app/admin/email-templates/email-templates-client.tsx +15 -58
- package/src/app/admin/error.tsx +1 -7
- package/src/app/admin/fleet-updates/error.tsx +1 -7
- package/src/app/admin/fleet-updates/fleet-updates-client.tsx +10 -50
- package/src/app/admin/layout.tsx +4 -0
- package/src/app/admin/payment-methods/page.tsx +9 -38
- package/src/app/admin/products/error.tsx +2 -7
- package/src/app/admin/products/page.tsx +1 -4
- package/src/app/admin/promotions/[id]/page.tsx +9 -38
- package/src/app/admin/promotions/page.tsx +9 -36
- package/src/app/admin/rate-overrides/page.tsx +9 -45
- package/src/app/auth/callback/[provider]/page.tsx +1 -8
- package/src/app/auth/verify/page.tsx +9 -36
- package/src/app/channels/error.tsx +2 -10
- package/src/app/channels/layout.tsx +9 -0
- package/src/app/channels/page.tsx +8 -20
- package/src/app/channels/setup/[plugin]/page.tsx +3 -5
- package/src/app/error.tsx +1 -7
- package/src/app/fleet/error.tsx +1 -7
- package/src/app/fleet/layout.tsx +5 -0
- package/src/app/fleet/settings/page.tsx +1 -3
- package/src/app/global-error.tsx +2 -10
- package/src/app/globals.css +1 -4
- package/src/app/instances/[id]/instance-detail-client.tsx +51 -125
- package/src/app/instances/error.tsx +2 -10
- package/src/app/instances/instance-list-client.tsx +20 -69
- package/src/app/instances/layout.tsx +9 -0
- package/src/app/instances/new/create-instance-client.tsx +10 -31
- package/src/app/layout.tsx +2 -10
- package/src/app/not-found.tsx +1 -3
- package/src/app/page.tsx +1 -2
- package/src/app/plugins/error.tsx +2 -10
- package/src/app/plugins/layout.tsx +5 -0
- package/src/app/plugins/page.tsx +16 -48
- package/src/app/pricing/error.tsx +1 -7
- package/src/app/privacy/page.tsx +93 -150
- package/src/app/status/error.tsx +1 -7
- package/src/app/terms/page.tsx +89 -144
- package/src/components/account-switcher.tsx +25 -52
- package/src/components/admin/accounting-dashboard.tsx +1 -3
- package/src/components/admin/admin-guard.tsx +1 -3
- package/src/components/admin/admin-nav.tsx +1 -3
- package/src/components/admin/affiliate-dashboard.tsx +25 -94
- package/src/components/admin/audit-log-table.tsx +13 -49
- package/src/components/admin/billing-health-dashboard.tsx +7 -25
- package/src/components/admin/bulk-actions-bar.test.tsx +1 -7
- package/src/components/admin/bulk-actions-bar.tsx +1 -3
- package/src/components/admin/bulk-export-dialog.test.tsx +1 -7
- package/src/components/admin/bulk-export-dialog.tsx +6 -32
- package/src/components/admin/bulk-grant-dialog.test.tsx +2 -6
- package/src/components/admin/bulk-grant-dialog.tsx +4 -15
- package/src/components/admin/bulk-preview-dialog.tsx +3 -12
- package/src/components/admin/bulk-reactivate-dialog.tsx +1 -7
- package/src/components/admin/bulk-select-all-banner.tsx +1 -6
- package/src/components/admin/bulk-suspend-dialog.tsx +5 -12
- package/src/components/admin/bulk-undo-toast.tsx +1 -2
- package/src/components/admin/compliance-dashboard.tsx +31 -101
- package/src/components/admin/gpu-dashboard.tsx +21 -70
- package/src/components/admin/grant-credits-dialog.tsx +4 -17
- package/src/components/admin/incident-dashboard.tsx +10 -25
- package/src/components/admin/inference-dashboard.tsx +14 -54
- package/src/components/admin/marketplace-admin.tsx +18 -60
- package/src/components/admin/migrations-dashboard.tsx +9 -42
- package/src/components/admin/onboarding-dashboard.tsx +14 -64
- package/src/components/admin/pool-config-dashboard.tsx +4 -10
- package/src/components/admin/products/fleet-form.tsx +2 -11
- package/src/components/admin/products/nav-editor.tsx +3 -10
- package/src/components/admin/promotions/promotion-form.tsx +9 -42
- package/src/components/admin/roles-dashboard.tsx +7 -34
- package/src/components/admin/suspend-dialog.tsx +4 -11
- package/src/components/admin/tenant-notes-panel.tsx +1 -3
- package/src/components/admin/tenant-row-actions.tsx +4 -20
- package/src/components/admin/tenant-table.tsx +12 -49
- package/src/components/auth/auth-redirect.tsx +11 -3
- package/src/components/auth/email-verification-result-banner.tsx +1 -3
- package/src/components/auth/resend-verification-button.tsx +2 -10
- package/src/components/auth/wopr-wordmark.tsx +1 -3
- package/src/components/billing/add-payment-method-dialog.tsx +1 -2
- package/src/components/billing/affiliate-dashboard.tsx +4 -16
- package/src/components/billing/amount-selector.tsx +1 -3
- package/src/components/billing/auto-topup-card.tsx +2 -11
- package/src/components/billing/buy-credits-panel.tsx +14 -17
- package/src/components/billing/byok-callout.tsx +6 -8
- package/src/components/billing/confirmation-tracker.tsx +4 -14
- package/src/components/billing/credit-balance-badge.tsx +22 -0
- package/src/components/billing/credit-balance.tsx +3 -9
- package/src/components/billing/crypto-checkout.tsx +5 -24
- package/src/components/billing/degraded-state-banner.tsx +1 -3
- package/src/components/billing/deposit-view.tsx +301 -41
- package/src/components/billing/dividend-banner.tsx +1 -3
- package/src/components/billing/dividend-eligibility.tsx +3 -12
- package/src/components/billing/dividend-pool-stats.tsx +6 -20
- package/src/components/billing/first-dividend-dialog.tsx +2 -2
- package/src/components/billing/org-billing-page.tsx +8 -31
- package/src/components/billing/payment-method-picker.tsx +2 -10
- package/src/components/billing/suspension-banner.tsx +2 -7
- package/src/components/billing/transaction-history.tsx +10 -58
- package/src/components/billing/unified-checkout.tsx +547 -0
- package/src/components/bot-settings/backups-tab.tsx +9 -33
- package/src/components/bot-settings/bot-settings-client.tsx +32 -134
- package/src/components/bot-settings/resources-tab.tsx +2 -9
- package/src/components/bot-settings/storage-tab.tsx +19 -48
- package/src/components/bot-settings/vps-info-panel.tsx +3 -11
- package/src/components/bot-settings/vps-upgrade-card.tsx +3 -4
- package/src/components/brand-hydrator.tsx +13 -0
- package/src/components/channel-wizard/field-interactive.tsx +1 -3
- package/src/components/channel-wizard/field-qr.tsx +10 -39
- package/src/components/channel-wizard/step-renderer.tsx +5 -28
- package/src/components/channel-wizard/wizard.tsx +6 -31
- package/src/components/chat/chat-message.tsx +1 -4
- package/src/components/chat/chat-panel.tsx +4 -18
- package/src/components/chat/chat-widget.tsx +3 -14
- package/src/components/dashboard/command-center.tsx +15 -61
- package/src/components/fleet/update-settings-card.tsx +7 -23
- package/src/components/instance-update-banner.tsx +130 -0
- package/src/components/instances/friends-tab.test.tsx +2 -9
- package/src/components/instances/friends-tab.tsx +18 -74
- package/src/components/instances/update-available-badge.tsx +2 -11
- package/src/components/landing/hero.tsx +3 -9
- package/src/components/landing/landing-page.tsx +1 -3
- package/src/components/landing/portfolio-chart.tsx +4 -9
- package/src/components/landing/story-sections.tsx +1 -3
- package/src/components/landing/terminal-sequence.tsx +4 -17
- package/src/components/marketplace/empty-state.tsx +2 -6
- package/src/components/marketplace/first-visit-hero.tsx +1 -3
- package/src/components/marketplace/install-wizard.tsx +20 -77
- package/src/components/marketplace/marketplace-tabs.tsx +1 -4
- package/src/components/marketplace/plugin-card.tsx +2 -9
- package/src/components/marketplace/superpower-content.tsx +1 -3
- package/src/components/marketplace/terminal-search.tsx +2 -8
- package/src/components/oauth-buttons.tsx +29 -14
- package/src/components/observability/fleet-health.tsx +5 -18
- package/src/components/observability/health-overview.tsx +7 -20
- package/src/components/observability/logs-viewer.tsx +8 -32
- package/src/components/observability/metrics-dashboard.tsx +2 -15
- package/src/components/onboarding/fallback-setup.tsx +6 -25
- package/src/components/onboarding/setup-checklist.tsx +18 -51
- package/src/components/onboarding/step-superpowers.tsx +1 -4
- package/src/components/plugin-setup/setup-chat-panel.tsx +6 -22
- package/src/components/pricing/dividend-calculator.tsx +6 -12
- package/src/components/pricing/dividend-stats.tsx +5 -17
- package/src/components/pricing/pricing-page.tsx +17 -36
- package/src/components/settings/create-org-wizard.tsx +2 -5
- package/src/components/sidebar.tsx +7 -42
- package/src/components/sidecar-frame.tsx +78 -0
- package/src/components/status/status-page.tsx +6 -28
- package/src/components/ui/alert-dialog.tsx +8 -25
- package/src/components/ui/badge.tsx +2 -8
- package/src/components/ui/banner.tsx +1 -6
- package/src/components/ui/card.tsx +5 -24
- package/src/components/ui/checkbox.tsx +1 -5
- package/src/components/ui/collapsible.tsx +3 -8
- package/src/components/ui/dialog.tsx +4 -10
- package/src/components/ui/dropdown-menu.tsx +9 -18
- package/src/components/ui/form.tsx +2 -16
- package/src/components/ui/popover.tsx +3 -23
- package/src/components/ui/progress.tsx +1 -5
- package/src/components/ui/radio-group.tsx +3 -15
- package/src/components/ui/select.tsx +4 -17
- package/src/components/ui/sheet.tsx +5 -19
- package/src/components/ui/skeleton.tsx +1 -7
- package/src/components/ui/table.tsx +5 -22
- package/src/components/ui/tabs.tsx +3 -13
- package/src/components/ui/tooltip.tsx +1 -1
- package/src/components/unified-sidebar.tsx +493 -0
- package/src/hooks/__tests__/use-fleet-sse.test.ts +1 -4
- package/src/hooks/__tests__/use-save-queue.test.ts +2 -8
- package/src/hooks/use-credit-balance.ts +27 -0
- package/src/hooks/use-my-org-role.ts +1 -3
- package/src/hooks/use-plugin-registry.ts +8 -14
- package/src/hooks/use-plugin-setup-chat.ts +2 -5
- package/src/hooks/use-sidecar-bridge.tsx +148 -0
- package/src/hooks/use-webmcp.ts +1 -4
- package/src/lib/__tests__/admin-api.test.ts +1 -3
- package/src/lib/__tests__/api-bot-crud.test.ts +8 -18
- package/src/lib/__tests__/api-fetch.test.ts +4 -16
- package/src/lib/__tests__/org-billing-api.test.ts +1 -3
- package/src/lib/__tests__/pricing-data.test.ts +0 -8
- package/src/lib/__tests__/settings-api.test.ts +1 -3
- package/src/lib/admin-affiliate-api.ts +2 -7
- package/src/lib/admin-api.ts +6 -26
- package/src/lib/admin-incident-api.ts +11 -19
- package/src/lib/admin-marketplace-api.ts +1 -5
- package/src/lib/api-config.test.ts +5 -50
- package/src/lib/api.ts +143 -122
- package/src/lib/auth-client.ts +1 -2
- package/src/lib/bot-settings-data.ts +11 -36
- package/src/lib/brand-config.ts +56 -115
- package/src/lib/brand.ts +2 -15
- package/src/lib/chat/use-chat.ts +2 -7
- package/src/lib/cost-comparison-data.test.ts +1 -3
- package/src/lib/cost-comparison-data.ts +1 -4
- package/src/lib/errors.ts +1 -4
- package/src/lib/fetch-utils.test.ts +26 -9
- package/src/lib/fetch-utils.ts +40 -11
- package/src/lib/logger.ts +2 -0
- package/src/lib/marketplace-data.ts +3 -11
- package/src/lib/oauth-errors.ts +2 -4
- package/src/lib/onboarding-data.ts +3 -11
- package/src/lib/org-api.ts +2 -10
- package/src/lib/org-billing-api.ts +5 -19
- package/src/lib/plugin/tool-definitions.ts +1 -2
- package/src/lib/require-auth.ts +57 -0
- package/src/lib/settings-api.ts +1 -4
- package/src/lib/sidecar-routes.ts +43 -0
- package/src/lib/trpc-server.ts +49 -0
- package/src/lib/trpc-types.ts +4 -6
- package/src/lib/trpc.tsx +12 -4
- package/src/lib/validate-redirect-url.ts +1 -4
- package/src/lib/webmcp/marketplace-onboarding-tools.ts +6 -16
- package/src/lib/webmcp/register.ts +1 -4
- package/src/lib/webmcp/tools.ts +2 -9
- package/src/proxy.ts +35 -212
- package/src/types/missing-deps.d.ts +2 -8
- package/tsconfig.json +1 -8
- package/biome.json +0 -52
- package/src/__tests__/__snapshots__/layout-snapshots.test.tsx.snap +0 -741
- package/src/__tests__/billing-byok-callout.test.tsx +0 -76
- package/src/lib/__tests__/__snapshots__/pricing-data.test.ts.snap +0 -112
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { trpcVanillaProxy } from "./setup.js";
|
|
2
3
|
|
|
3
4
|
const mockFetch = vi.fn();
|
|
4
5
|
global.fetch = mockFetch;
|
|
@@ -21,7 +22,7 @@ vi.mock("@/lib/fetch-utils", () => ({
|
|
|
21
22
|
}));
|
|
22
23
|
|
|
23
24
|
vi.mock("@/lib/trpc", () => ({
|
|
24
|
-
trpcVanilla:
|
|
25
|
+
trpcVanilla: trpcVanillaProxy,
|
|
25
26
|
}));
|
|
26
27
|
|
|
27
28
|
import { removeProviderKey, saveProviderKey } from "@/lib/api";
|
|
@@ -16,20 +16,14 @@ vi.mock("better-auth/react", () => ({
|
|
|
16
16
|
|
|
17
17
|
vi.mock("framer-motion", () => ({
|
|
18
18
|
motion: {
|
|
19
|
-
div: ({ children, ...props }: React.PropsWithChildren<Record<string, unknown>>) =>
|
|
20
|
-
|
|
21
|
-
),
|
|
22
|
-
p: ({ children, ...props }: React.PropsWithChildren<Record<string, unknown>>) => (
|
|
23
|
-
<p {...props}>{children}</p>
|
|
24
|
-
),
|
|
19
|
+
div: ({ children, ...props }: React.PropsWithChildren<Record<string, unknown>>) => <div {...props}>{children}</div>,
|
|
20
|
+
p: ({ children, ...props }: React.PropsWithChildren<Record<string, unknown>>) => <p {...props}>{children}</p>,
|
|
25
21
|
},
|
|
26
22
|
}));
|
|
27
23
|
|
|
28
24
|
describe("ResendVerificationButton", () => {
|
|
29
25
|
it("renders button with correct text", async () => {
|
|
30
|
-
const { ResendVerificationButton } = await import(
|
|
31
|
-
"@/components/auth/resend-verification-button"
|
|
32
|
-
);
|
|
26
|
+
const { ResendVerificationButton } = await import("@/components/auth/resend-verification-button");
|
|
33
27
|
render(<ResendVerificationButton email="test@example.com" />);
|
|
34
28
|
|
|
35
29
|
expect(screen.getByRole("button", { name: /Resend verification email/ })).toBeInTheDocument();
|
|
@@ -37,9 +31,7 @@ describe("ResendVerificationButton", () => {
|
|
|
37
31
|
|
|
38
32
|
it("calls sendVerificationEmail on click", async () => {
|
|
39
33
|
const user = userEvent.setup();
|
|
40
|
-
const { ResendVerificationButton } = await import(
|
|
41
|
-
"@/components/auth/resend-verification-button"
|
|
42
|
-
);
|
|
34
|
+
const { ResendVerificationButton } = await import("@/components/auth/resend-verification-button");
|
|
43
35
|
render(<ResendVerificationButton email="test@example.com" />);
|
|
44
36
|
|
|
45
37
|
await user.click(screen.getByRole("button", { name: /Resend verification email/ }));
|
|
@@ -52,9 +44,7 @@ describe("ResendVerificationButton", () => {
|
|
|
52
44
|
|
|
53
45
|
it("shows success message after sending", async () => {
|
|
54
46
|
const user = userEvent.setup();
|
|
55
|
-
const { ResendVerificationButton } = await import(
|
|
56
|
-
"@/components/auth/resend-verification-button"
|
|
57
|
-
);
|
|
47
|
+
const { ResendVerificationButton } = await import("@/components/auth/resend-verification-button");
|
|
58
48
|
render(<ResendVerificationButton email="test@example.com" />);
|
|
59
49
|
|
|
60
50
|
await user.click(screen.getByRole("button", { name: /Resend verification email/ }));
|
|
@@ -68,9 +58,7 @@ describe("ResendVerificationButton", () => {
|
|
|
68
58
|
error: { message: "Rate limited" },
|
|
69
59
|
});
|
|
70
60
|
const user = userEvent.setup();
|
|
71
|
-
const { ResendVerificationButton } = await import(
|
|
72
|
-
"@/components/auth/resend-verification-button"
|
|
73
|
-
);
|
|
61
|
+
const { ResendVerificationButton } = await import("@/components/auth/resend-verification-button");
|
|
74
62
|
render(<ResendVerificationButton email="test@example.com" />);
|
|
75
63
|
|
|
76
64
|
await user.click(screen.getByRole("button", { name: /Resend verification email/ }));
|
|
@@ -79,9 +67,7 @@ describe("ResendVerificationButton", () => {
|
|
|
79
67
|
});
|
|
80
68
|
|
|
81
69
|
it("disables button when email is empty", async () => {
|
|
82
|
-
const { ResendVerificationButton } = await import(
|
|
83
|
-
"@/components/auth/resend-verification-button"
|
|
84
|
-
);
|
|
70
|
+
const { ResendVerificationButton } = await import("@/components/auth/resend-verification-button");
|
|
85
71
|
render(<ResendVerificationButton email="" />);
|
|
86
72
|
|
|
87
73
|
expect(screen.getByRole("button", { name: /Resend verification email/ })).toBeDisabled();
|
|
@@ -89,9 +75,7 @@ describe("ResendVerificationButton", () => {
|
|
|
89
75
|
|
|
90
76
|
it("disables button after successful send", async () => {
|
|
91
77
|
const user = userEvent.setup();
|
|
92
|
-
const { ResendVerificationButton } = await import(
|
|
93
|
-
"@/components/auth/resend-verification-button"
|
|
94
|
-
);
|
|
78
|
+
const { ResendVerificationButton } = await import("@/components/auth/resend-verification-button");
|
|
95
79
|
render(<ResendVerificationButton email="test@example.com" />);
|
|
96
80
|
|
|
97
81
|
await user.click(screen.getByRole("button", { name: /Resend verification email/ }));
|
|
@@ -13,9 +13,7 @@ vi.mock("framer-motion", () => ({
|
|
|
13
13
|
void animate;
|
|
14
14
|
void exit;
|
|
15
15
|
void transition;
|
|
16
|
-
return (
|
|
17
|
-
<div {...(rest as React.HTMLAttributes<HTMLDivElement>)}>{children as React.ReactNode}</div>
|
|
18
|
-
);
|
|
16
|
+
return <div {...(rest as React.HTMLAttributes<HTMLDivElement>)}>{children as React.ReactNode}</div>;
|
|
19
17
|
},
|
|
20
18
|
},
|
|
21
19
|
}));
|
|
@@ -200,14 +200,10 @@ vi.mock("@/lib/api", async (importOriginal) => {
|
|
|
200
200
|
saveProviderKey: vi.fn().mockResolvedValue({ ok: true, id: "test-id", provider: "openai" }),
|
|
201
201
|
updateProviderModel: vi.fn().mockResolvedValue(undefined),
|
|
202
202
|
listApiKeys: vi.fn().mockResolvedValue(MOCK_API_KEYS),
|
|
203
|
-
createApiKey: vi
|
|
204
|
-
.fn()
|
|
205
|
-
.mockResolvedValue({ key: MOCK_API_KEYS[0], secret: "platform_test_secret" }),
|
|
203
|
+
createApiKey: vi.fn().mockResolvedValue({ key: MOCK_API_KEYS[0], secret: "platform_test_secret" }),
|
|
206
204
|
revokeApiKey: vi.fn().mockResolvedValue(undefined),
|
|
207
205
|
getBillingUsage: vi.fn().mockResolvedValue(MOCK_BILLING_USAGE),
|
|
208
|
-
createBillingPortalSession: vi
|
|
209
|
-
.fn()
|
|
210
|
-
.mockResolvedValue({ url: "https://billing.stripe.com/session/test" }),
|
|
206
|
+
createBillingPortalSession: vi.fn().mockResolvedValue({ url: "https://billing.stripe.com/session/test" }),
|
|
211
207
|
storeTenantKey: vi.fn().mockResolvedValue({
|
|
212
208
|
provider: "anthropic",
|
|
213
209
|
hasKey: true,
|
|
@@ -270,9 +266,7 @@ vi.mock("@/lib/org-api", () => ({
|
|
|
270
266
|
revokeInvite: vi.fn().mockResolvedValue(undefined),
|
|
271
267
|
removeMember: vi.fn().mockResolvedValue(undefined),
|
|
272
268
|
transferOwnership: vi.fn().mockResolvedValue(undefined),
|
|
273
|
-
createOrganization: vi
|
|
274
|
-
.fn()
|
|
275
|
-
.mockResolvedValue({ id: "org-new", name: "Test Org", slug: "test-org" }),
|
|
269
|
+
createOrganization: vi.fn().mockResolvedValue({ id: "org-new", name: "Test Org", slug: "test-org" }),
|
|
276
270
|
}));
|
|
277
271
|
|
|
278
272
|
// Mock @/lib/auth-client for OAuth account linking
|
|
@@ -299,8 +293,8 @@ describe("Profile page", () => {
|
|
|
299
293
|
// Initially shows skeleton loading state
|
|
300
294
|
expect(document.querySelector('[data-slot="skeleton"]')).toBeInTheDocument();
|
|
301
295
|
|
|
302
|
-
// Wait for mock data to load
|
|
303
|
-
expect(await screen.findByText("
|
|
296
|
+
// Wait for mock data to load — heading is now "Settings"
|
|
297
|
+
expect(await screen.findByText("Settings")).toBeInTheDocument();
|
|
304
298
|
expect(screen.getByLabelText("Display name")).toBeInTheDocument();
|
|
305
299
|
expect(screen.getByLabelText("Email")).toBeInTheDocument();
|
|
306
300
|
});
|
|
@@ -454,9 +448,7 @@ describe("Providers page - billing gate", () => {
|
|
|
454
448
|
await user.click(hostedRadio);
|
|
455
449
|
|
|
456
450
|
// Dialog opens — wait for billing check to complete
|
|
457
|
-
expect(
|
|
458
|
-
await screen.findByText(/Enable Platform Hosted for Text Generation/),
|
|
459
|
-
).toBeInTheDocument();
|
|
451
|
+
expect(await screen.findByText(/Enable Platform Hosted for Text Generation/)).toBeInTheDocument();
|
|
460
452
|
// With a payment method on file, the Enable Hosted button should appear
|
|
461
453
|
expect(await screen.findByRole("button", { name: "Enable Hosted" })).toBeInTheDocument();
|
|
462
454
|
});
|
|
@@ -878,9 +870,7 @@ describe("Notifications page - no team language", () => {
|
|
|
878
870
|
fleet_updates: true,
|
|
879
871
|
});
|
|
880
872
|
|
|
881
|
-
const { default: NotificationsPage } = await import(
|
|
882
|
-
"../app/(dashboard)/settings/notifications/page"
|
|
883
|
-
);
|
|
873
|
+
const { default: NotificationsPage } = await import("../app/(dashboard)/settings/notifications/page");
|
|
884
874
|
render(<NotificationsPage />);
|
|
885
875
|
|
|
886
876
|
await screen.findByText("Notifications");
|
|
@@ -895,7 +885,7 @@ describe("Avatar upload", () => {
|
|
|
895
885
|
const { default: ProfilePage } = await import("../app/(dashboard)/settings/profile/page");
|
|
896
886
|
render(<ProfilePage />);
|
|
897
887
|
|
|
898
|
-
expect(await screen.findByText("
|
|
888
|
+
expect(await screen.findByText("Settings")).toBeInTheDocument();
|
|
899
889
|
expect(screen.getByLabelText("Change avatar")).toBeInTheDocument();
|
|
900
890
|
});
|
|
901
891
|
|
|
@@ -903,7 +893,7 @@ describe("Avatar upload", () => {
|
|
|
903
893
|
const { default: ProfilePage } = await import("../app/(dashboard)/settings/profile/page");
|
|
904
894
|
render(<ProfilePage />);
|
|
905
895
|
|
|
906
|
-
await screen.findByText("
|
|
896
|
+
await screen.findByText("Settings");
|
|
907
897
|
expect(screen.getByText("A")).toBeInTheDocument();
|
|
908
898
|
});
|
|
909
899
|
|
|
@@ -916,7 +906,7 @@ describe("Avatar upload", () => {
|
|
|
916
906
|
const { default: ProfilePage } = await import("../app/(dashboard)/settings/profile/page");
|
|
917
907
|
render(<ProfilePage />);
|
|
918
908
|
|
|
919
|
-
await screen.findByText("
|
|
909
|
+
await screen.findByText("Settings");
|
|
920
910
|
|
|
921
911
|
const file = new File(["fake-image"], "avatar.png", { type: "image/png" });
|
|
922
912
|
const input = screen.getByLabelText("Change avatar") as HTMLInputElement;
|
|
@@ -932,7 +922,7 @@ describe("Avatar upload", () => {
|
|
|
932
922
|
const { default: ProfilePage } = await import("../app/(dashboard)/settings/profile/page");
|
|
933
923
|
render(<ProfilePage />);
|
|
934
924
|
|
|
935
|
-
await screen.findByText("
|
|
925
|
+
await screen.findByText("Settings");
|
|
936
926
|
|
|
937
927
|
const largeFile = new File([new ArrayBuffer(3 * 1024 * 1024)], "big.png", {
|
|
938
928
|
type: "image/png",
|
|
@@ -46,9 +46,7 @@ vi.mock("@/lib/marketplace-data", () => ({
|
|
|
46
46
|
|
|
47
47
|
// Mock next/link
|
|
48
48
|
vi.mock("next/link", () => ({
|
|
49
|
-
default: ({ href, children }: { href: string; children: React.ReactNode }) =>
|
|
50
|
-
<a href={href}>{children}</a>
|
|
51
|
-
),
|
|
49
|
+
default: ({ href, children }: { href: string; children: React.ReactNode }) => <a href={href}>{children}</a>,
|
|
52
50
|
}));
|
|
53
51
|
|
|
54
52
|
import type { CapabilitySetting, ChannelInfo } from "@/lib/api";
|
|
@@ -254,13 +252,9 @@ describe("SetupChecklist", () => {
|
|
|
254
252
|
mockGetCreditBalance.mockResolvedValue({ balance: 0, dailyBurn: 0, runway: null });
|
|
255
253
|
mockListChannels.mockImplementation((botId: string) => {
|
|
256
254
|
if (botId === "inst-001") {
|
|
257
|
-
return Promise.resolve([
|
|
258
|
-
{ id: "ch-1", name: "discord-general", type: "discord", status: "disconnected" },
|
|
259
|
-
]);
|
|
255
|
+
return Promise.resolve([{ id: "ch-1", name: "discord-general", type: "discord", status: "disconnected" }]);
|
|
260
256
|
}
|
|
261
|
-
return Promise.resolve([
|
|
262
|
-
{ id: "ch-2", name: "discord-other", type: "discord", status: "connected" },
|
|
263
|
-
]);
|
|
257
|
+
return Promise.resolve([{ id: "ch-2", name: "discord-other", type: "discord", status: "connected" }]);
|
|
264
258
|
});
|
|
265
259
|
mockListCapabilities.mockResolvedValue([]);
|
|
266
260
|
|
package/src/__tests__/setup.ts
CHANGED
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
import "@testing-library/jest-dom/vitest";
|
|
2
2
|
import { vi } from "vitest";
|
|
3
3
|
|
|
4
|
+
// Mock @/lib/trpc globally — trpcVanilla is used by api.ts functions (getProfile, etc.)
|
|
5
|
+
// and most tests mock fetch/apiFetch instead. This proxy returns empty results for any
|
|
6
|
+
// trpcVanilla.namespace.procedure.query/mutate() call chain.
|
|
7
|
+
export const trpcVanillaProxy: unknown = new Proxy(
|
|
8
|
+
{},
|
|
9
|
+
{
|
|
10
|
+
get(_target, prop) {
|
|
11
|
+
if (prop === "query") return vi.fn().mockResolvedValue({});
|
|
12
|
+
if (prop === "mutate") return vi.fn().mockResolvedValue({});
|
|
13
|
+
if (prop === "useQuery") return vi.fn().mockReturnValue({ data: undefined, isLoading: false, error: null });
|
|
14
|
+
if (prop === "useMutation")
|
|
15
|
+
return vi.fn().mockReturnValue({ mutate: vi.fn(), mutateAsync: vi.fn(), isLoading: false });
|
|
16
|
+
return trpcVanillaProxy;
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
vi.mock("@/lib/trpc", () => ({
|
|
22
|
+
trpc: trpcVanillaProxy,
|
|
23
|
+
trpcVanilla: trpcVanillaProxy,
|
|
24
|
+
TRPCProvider: ({ children }: { children: React.ReactNode }) => children,
|
|
25
|
+
}));
|
|
26
|
+
|
|
4
27
|
// Default fetch mock: reject all API calls so components fall back to mock data immediately.
|
|
5
28
|
// Individual tests can override with vi.stubGlobal("fetch", ...) as needed.
|
|
6
|
-
vi.stubGlobal(
|
|
7
|
-
"fetch",
|
|
8
|
-
vi.fn().mockRejectedValue(new Error("Network request not allowed in tests")),
|
|
9
|
-
);
|
|
29
|
+
vi.stubGlobal("fetch", vi.fn().mockRejectedValue(new Error("Network request not allowed in tests")));
|
|
10
30
|
|
|
11
31
|
// Polyfill IntersectionObserver for framer-motion whileInView in test env
|
|
12
32
|
class MockIntersectionObserver {
|
|
@@ -28,8 +48,7 @@ class MockIntersectionObserver {
|
|
|
28
48
|
}
|
|
29
49
|
|
|
30
50
|
if (typeof globalThis.IntersectionObserver === "undefined") {
|
|
31
|
-
globalThis.IntersectionObserver =
|
|
32
|
-
MockIntersectionObserver as unknown as typeof IntersectionObserver;
|
|
51
|
+
globalThis.IntersectionObserver = MockIntersectionObserver as unknown as typeof IntersectionObserver;
|
|
33
52
|
}
|
|
34
53
|
|
|
35
54
|
// Polyfill window.matchMedia for components that call it in useEffect (e.g. TerminalSequence).
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { trpcVanillaProxy } from "./setup.js";
|
|
2
3
|
|
|
3
4
|
const mockFetch = vi.fn();
|
|
4
5
|
vi.stubGlobal("fetch", mockFetch);
|
|
@@ -13,7 +14,7 @@ vi.mock("@/lib/fetch-utils", () => ({
|
|
|
13
14
|
}));
|
|
14
15
|
|
|
15
16
|
vi.mock("@/lib/trpc", () => ({
|
|
16
|
-
trpcVanilla:
|
|
17
|
+
trpcVanilla: trpcVanillaProxy,
|
|
17
18
|
}));
|
|
18
19
|
|
|
19
20
|
import { createSnapshot, deleteSnapshot, listSnapshots, restoreSnapshot } from "@/lib/api";
|
|
@@ -167,9 +167,7 @@ describe("StepSuperpowers", () => {
|
|
|
167
167
|
it("shows fleet-add description in fleet-add mode", () => {
|
|
168
168
|
render(<StepSuperpowers selected={[]} onToggle={vi.fn()} mode="fleet-add" />);
|
|
169
169
|
|
|
170
|
-
expect(
|
|
171
|
-
screen.getByText("Pre-checked from your other bots. Add or remove as you like."),
|
|
172
|
-
).toBeInTheDocument();
|
|
170
|
+
expect(screen.getByText("Pre-checked from your other bots. Add or remove as you like.")).toBeInTheDocument();
|
|
173
171
|
});
|
|
174
172
|
});
|
|
175
173
|
|
|
@@ -16,12 +16,7 @@ vi.mock("@/lib/trpc", () => ({
|
|
|
16
16
|
},
|
|
17
17
|
}));
|
|
18
18
|
|
|
19
|
-
import {
|
|
20
|
-
getActiveTenantId,
|
|
21
|
-
setServerTenantId,
|
|
22
|
-
TenantProvider,
|
|
23
|
-
useTenant,
|
|
24
|
-
} from "@/lib/tenant-context";
|
|
19
|
+
import { getActiveTenantId, setServerTenantId, TenantProvider, useTenant } from "@/lib/tenant-context";
|
|
25
20
|
|
|
26
21
|
function createWrapper(initialTenantId?: string) {
|
|
27
22
|
const queryClient = new QueryClient({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { trpcVanillaProxy } from "./setup.js";
|
|
2
3
|
|
|
3
4
|
// Mock the fetch at the module level
|
|
4
5
|
const mockFetch = vi.fn();
|
|
@@ -23,7 +24,7 @@ vi.mock("@/lib/fetch-utils", () => ({
|
|
|
23
24
|
}));
|
|
24
25
|
|
|
25
26
|
vi.mock("@/lib/trpc", () => ({
|
|
26
|
-
trpcVanilla:
|
|
27
|
+
trpcVanilla: trpcVanillaProxy,
|
|
27
28
|
}));
|
|
28
29
|
|
|
29
30
|
import { deleteTenantKey, getTenantKey, listTenantKeys, storeTenantKey } from "@/lib/api";
|
|
@@ -34,9 +35,7 @@ describe("tenant-keys API", () => {
|
|
|
34
35
|
});
|
|
35
36
|
|
|
36
37
|
it("listTenantKeys calls GET /api/tenant-keys", async () => {
|
|
37
|
-
const mockData = [
|
|
38
|
-
{ provider: "openai", hasKey: true, maskedKey: "sk-...ab", createdAt: null, updatedAt: null },
|
|
39
|
-
];
|
|
38
|
+
const mockData = [{ provider: "openai", hasKey: true, maskedKey: "sk-...ab", createdAt: null, updatedAt: null }];
|
|
40
39
|
mockFetch.mockResolvedValueOnce({
|
|
41
40
|
ok: true,
|
|
42
41
|
status: 200,
|
|
@@ -54,9 +54,7 @@ describe("TenantTable pagination", () => {
|
|
|
54
54
|
render(<TenantTable />);
|
|
55
55
|
|
|
56
56
|
await screen.findByText("user0@test.com");
|
|
57
|
-
expect(mockGetUsersList).toHaveBeenCalledWith(
|
|
58
|
-
expect.objectContaining({ offset: 0, limit: 25 }),
|
|
59
|
-
);
|
|
57
|
+
expect(mockGetUsersList).toHaveBeenCalledWith(expect.objectContaining({ offset: 0, limit: 25 }));
|
|
60
58
|
});
|
|
61
59
|
|
|
62
60
|
it("clicking Next requests offset 25 (not 50)", async () => {
|
|
@@ -70,9 +68,7 @@ describe("TenantTable pagination", () => {
|
|
|
70
68
|
await user.click(screen.getByRole("button", { name: "Next" }));
|
|
71
69
|
|
|
72
70
|
await screen.findByText("user25@test.com");
|
|
73
|
-
expect(mockGetUsersList).toHaveBeenLastCalledWith(
|
|
74
|
-
expect.objectContaining({ offset: 25, limit: 25 }),
|
|
75
|
-
);
|
|
71
|
+
expect(mockGetUsersList).toHaveBeenLastCalledWith(expect.objectContaining({ offset: 25, limit: 25 }));
|
|
76
72
|
});
|
|
77
73
|
|
|
78
74
|
it("shows correct range text on page 2", async () => {
|
|
@@ -35,7 +35,6 @@ describe("TerminalLog cleanup", () => {
|
|
|
35
35
|
const clearTimeoutSpy = vi.spyOn(globalThis, "clearTimeout");
|
|
36
36
|
const onDone = vi.fn();
|
|
37
37
|
|
|
38
|
-
// biome-ignore lint/suspicious/noExplicitAny: test only
|
|
39
38
|
const { unmount } = render(<TerminalLog plugin={fakePlugin as any} onDone={onDone} />);
|
|
40
39
|
|
|
41
40
|
// Advance past all interval ticks + into the setTimeout territory
|