@pasosdejesus/m 0.15.0
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/blockchain/deployments.d.ts +40 -0
- package/dist/blockchain/deployments.d.ts.map +1 -0
- package/dist/blockchain/deployments.js +64 -0
- package/dist/debug/DebugConsole.d.ts +22 -0
- package/dist/debug/DebugConsole.d.ts.map +1 -0
- package/dist/debug/DebugConsole.js +79 -0
- package/dist/debug/Logger.d.ts +38 -0
- package/dist/debug/Logger.d.ts.map +1 -0
- package/dist/debug/Logger.js +94 -0
- package/dist/debug/index.d.ts +6 -0
- package/dist/debug/index.d.ts.map +1 -0
- package/dist/debug/index.js +4 -0
- package/dist/debug/useLogger.d.ts +14 -0
- package/dist/debug/useLogger.d.ts.map +1 -0
- package/dist/debug/useLogger.js +23 -0
- package/dist/debug/utils.d.ts +10 -0
- package/dist/debug/utils.d.ts.map +1 -0
- package/dist/debug/utils.js +53 -0
- package/dist/e2e/assertions.d.ts +5 -0
- package/dist/e2e/assertions.d.ts.map +1 -0
- package/dist/e2e/assertions.js +18 -0
- package/dist/e2e/browser.d.ts +37 -0
- package/dist/e2e/browser.d.ts.map +1 -0
- package/dist/e2e/browser.js +97 -0
- package/dist/e2e/env.d.ts +18 -0
- package/dist/e2e/env.d.ts.map +1 -0
- package/dist/e2e/env.js +57 -0
- package/dist/e2e/index.d.ts +11 -0
- package/dist/e2e/index.d.ts.map +1 -0
- package/dist/e2e/index.js +8 -0
- package/dist/e2e/navigation.d.ts +4 -0
- package/dist/e2e/navigation.d.ts.map +1 -0
- package/dist/e2e/navigation.js +32 -0
- package/dist/e2e/siwe-mock.d.ts +11 -0
- package/dist/e2e/siwe-mock.d.ts.map +1 -0
- package/dist/e2e/siwe-mock.js +112 -0
- package/dist/e2e/siwe.d.ts +15 -0
- package/dist/e2e/siwe.d.ts.map +1 -0
- package/dist/e2e/siwe.js +85 -0
- package/dist/e2e/wallet-mock.d.ts +13 -0
- package/dist/e2e/wallet-mock.d.ts.map +1 -0
- package/dist/e2e/wallet-mock.js +91 -0
- package/dist/i18n/common-cli.d.ts +11 -0
- package/dist/i18n/common-cli.d.ts.map +1 -0
- package/dist/i18n/common-cli.js +22 -0
- package/dist/i18n/createTranslator.d.ts +28 -0
- package/dist/i18n/createTranslator.d.ts.map +1 -0
- package/dist/i18n/createTranslator.js +48 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +2 -0
- package/dist/i18n/locales/cli.d.ts +3 -0
- package/dist/i18n/locales/cli.d.ts.map +1 -0
- package/dist/i18n/locales/cli.js +180 -0
- package/dist/i18n/types.d.ts +3 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +10 -0
- package/dist/m.d.ts +2 -0
- package/dist/m.d.ts.map +1 -0
- package/dist/m.js +334 -0
- package/dist/plugin.d.ts +10 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +7 -0
- package/dist/shadcn_components/cn.d.ts +13 -0
- package/dist/shadcn_components/cn.d.ts.map +1 -0
- package/dist/shadcn_components/cn.js +15 -0
- package/dist/shadcn_components/ui/accordion.d.ts +8 -0
- package/dist/shadcn_components/ui/accordion.d.ts.map +1 -0
- package/dist/shadcn_components/ui/accordion.js +14 -0
- package/dist/shadcn_components/ui/alert-dialog.d.ts +21 -0
- package/dist/shadcn_components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/shadcn_components/ui/alert-dialog.js +27 -0
- package/dist/shadcn_components/ui/alert.d.ts +9 -0
- package/dist/shadcn_components/ui/alert.d.ts.map +1 -0
- package/dist/shadcn_components/ui/alert.js +22 -0
- package/dist/shadcn_components/ui/avatar.d.ts +7 -0
- package/dist/shadcn_components/ui/avatar.d.ts.map +1 -0
- package/dist/shadcn_components/ui/avatar.js +12 -0
- package/dist/shadcn_components/ui/badge.d.ts +10 -0
- package/dist/shadcn_components/ui/badge.d.ts.map +1 -0
- package/dist/shadcn_components/ui/badge.js +22 -0
- package/dist/shadcn_components/ui/button.d.ts +11 -0
- package/dist/shadcn_components/ui/button.d.ts.map +1 -0
- package/dist/shadcn_components/ui/button.js +31 -0
- package/dist/shadcn_components/ui/card.d.ts +10 -0
- package/dist/shadcn_components/ui/card.d.ts.map +1 -0
- package/dist/shadcn_components/ui/card.js +24 -0
- package/dist/shadcn_components/ui/checkbox.d.ts +5 -0
- package/dist/shadcn_components/ui/checkbox.d.ts.map +1 -0
- package/dist/shadcn_components/ui/checkbox.js +9 -0
- package/dist/shadcn_components/ui/dialog.d.ts +20 -0
- package/dist/shadcn_components/ui/dialog.d.ts.map +1 -0
- package/dist/shadcn_components/ui/dialog.js +23 -0
- package/dist/shadcn_components/ui/dropdown-menu.d.ts +28 -0
- package/dist/shadcn_components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/shadcn_components/ui/dropdown-menu.js +36 -0
- package/dist/shadcn_components/ui/form.d.ts +24 -0
- package/dist/shadcn_components/ui/form.d.ts.map +1 -0
- package/dist/shadcn_components/ui/form.js +63 -0
- package/dist/shadcn_components/ui/input.d.ts +4 -0
- package/dist/shadcn_components/ui/input.d.ts.map +1 -0
- package/dist/shadcn_components/ui/input.js +6 -0
- package/dist/shadcn_components/ui/label.d.ts +6 -0
- package/dist/shadcn_components/ui/label.d.ts.map +1 -0
- package/dist/shadcn_components/ui/label.js +10 -0
- package/dist/shadcn_components/ui/menubar.d.ts +29 -0
- package/dist/shadcn_components/ui/menubar.d.ts.map +1 -0
- package/dist/shadcn_components/ui/menubar.js +46 -0
- package/dist/shadcn_components/ui/popover.d.ts +7 -0
- package/dist/shadcn_components/ui/popover.d.ts.map +1 -0
- package/dist/shadcn_components/ui/popover.js +10 -0
- package/dist/shadcn_components/ui/progress.d.ts +5 -0
- package/dist/shadcn_components/ui/progress.d.ts.map +1 -0
- package/dist/shadcn_components/ui/progress.js +8 -0
- package/dist/shadcn_components/ui/radio-group.d.ts +6 -0
- package/dist/shadcn_components/ui/radio-group.d.ts.map +1 -0
- package/dist/shadcn_components/ui/radio-group.js +15 -0
- package/dist/shadcn_components/ui/scroll-area.d.ts +6 -0
- package/dist/shadcn_components/ui/scroll-area.d.ts.map +1 -0
- package/dist/shadcn_components/ui/scroll-area.js +12 -0
- package/dist/shadcn_components/ui/select.d.ts +14 -0
- package/dist/shadcn_components/ui/select.d.ts.map +1 -0
- package/dist/shadcn_components/ui/select.js +27 -0
- package/dist/shadcn_components/ui/separator.d.ts +5 -0
- package/dist/shadcn_components/ui/separator.d.ts.map +1 -0
- package/dist/shadcn_components/ui/separator.js +8 -0
- package/dist/shadcn_components/ui/sheet.d.ts +26 -0
- package/dist/shadcn_components/ui/sheet.d.ts.map +1 -0
- package/dist/shadcn_components/ui/sheet.js +37 -0
- package/dist/shadcn_components/ui/skeleton.d.ts +3 -0
- package/dist/shadcn_components/ui/skeleton.d.ts.map +1 -0
- package/dist/shadcn_components/ui/skeleton.js +6 -0
- package/dist/shadcn_components/ui/slider.d.ts +5 -0
- package/dist/shadcn_components/ui/slider.d.ts.map +1 -0
- package/dist/shadcn_components/ui/slider.js +8 -0
- package/dist/shadcn_components/ui/switch.d.ts +5 -0
- package/dist/shadcn_components/ui/switch.d.ts.map +1 -0
- package/dist/shadcn_components/ui/switch.js +8 -0
- package/dist/shadcn_components/ui/table.d.ts +11 -0
- package/dist/shadcn_components/ui/table.d.ts.map +1 -0
- package/dist/shadcn_components/ui/table.js +20 -0
- package/dist/shadcn_components/ui/tabs.d.ts +8 -0
- package/dist/shadcn_components/ui/tabs.d.ts.map +1 -0
- package/dist/shadcn_components/ui/tabs.js +13 -0
- package/dist/shadcn_components/ui/textarea.d.ts +4 -0
- package/dist/shadcn_components/ui/textarea.d.ts.map +1 -0
- package/dist/shadcn_components/ui/textarea.js +8 -0
- package/dist/shadcn_components/ui/toast.d.ts +16 -0
- package/dist/shadcn_components/ui/toast.d.ts.map +1 -0
- package/dist/shadcn_components/ui/toast.js +34 -0
- package/dist/shadcn_components/ui/toaster.d.ts +2 -0
- package/dist/shadcn_components/ui/toaster.d.ts.map +1 -0
- package/dist/shadcn_components/ui/toaster.js +10 -0
- package/dist/shadcn_components/ui/tooltip.d.ts +8 -0
- package/dist/shadcn_components/ui/tooltip.d.ts.map +1 -0
- package/dist/shadcn_components/ui/tooltip.js +11 -0
- package/dist/shadcn_components/ui/use-toast.d.ts +45 -0
- package/dist/shadcn_components/ui/use-toast.d.ts.map +1 -0
- package/dist/shadcn_components/ui/use-toast.js +126 -0
- package/dist/tasks/context.d.ts +13 -0
- package/dist/tasks/context.d.ts.map +1 -0
- package/dist/tasks/context.js +310 -0
- package/dist/tasks/create.d.ts +2 -0
- package/dist/tasks/create.d.ts.map +1 -0
- package/dist/tasks/create.js +91 -0
- package/dist/tasks/db.d.ts +19 -0
- package/dist/tasks/db.d.ts.map +1 -0
- package/dist/tasks/db.js +791 -0
- package/dist/tasks/e2e.d.ts +2 -0
- package/dist/tasks/e2e.d.ts.map +1 -0
- package/dist/tasks/e2e.js +124 -0
- package/dist/tasks/edit.d.ts +7 -0
- package/dist/tasks/edit.d.ts.map +1 -0
- package/dist/tasks/edit.js +471 -0
- package/dist/tasks/engine.d.ts +2 -0
- package/dist/tasks/engine.d.ts.map +1 -0
- package/dist/tasks/engine.js +149 -0
- package/dist/tasks/env-diff.d.ts +2 -0
- package/dist/tasks/env-diff.d.ts.map +1 -0
- package/dist/tasks/env-diff.js +140 -0
- package/dist/tasks/fuzzy.d.ts +9 -0
- package/dist/tasks/fuzzy.d.ts.map +1 -0
- package/dist/tasks/fuzzy.js +153 -0
- package/dist/tasks/glob.d.ts +5 -0
- package/dist/tasks/glob.d.ts.map +1 -0
- package/dist/tasks/glob.js +57 -0
- package/dist/tasks/grep.d.ts +9 -0
- package/dist/tasks/grep.d.ts.map +1 -0
- package/dist/tasks/grep.js +93 -0
- package/dist/tasks/readfile.d.ts +2 -0
- package/dist/tasks/readfile.d.ts.map +1 -0
- package/dist/tasks/readfile.js +177 -0
- package/dist/tasks/update.d.ts +5 -0
- package/dist/tasks/update.d.ts.map +1 -0
- package/dist/tasks/update.js +200 -0
- package/dist/tasks/util.d.ts +12 -0
- package/dist/tasks/util.d.ts.map +1 -0
- package/dist/tasks/util.js +42 -0
- package/dist/tasks/wallet.d.ts +2 -0
- package/dist/tasks/wallet.d.ts.map +1 -0
- package/dist/tasks/wallet.js +697 -0
- package/dist/tasks/writefile.d.ts +2 -0
- package/dist/tasks/writefile.d.ts.map +1 -0
- package/dist/tasks/writefile.js +66 -0
- package/dist/templates/AGENTS.md.hbs +81 -0
- package/dist/templates/ARCHITECTURE.md.hbs +146 -0
- package/dist/templates/CONTRIBUTING.md.hbs +83 -0
- package/dist/templates/LICENCIA.md +21 -0
- package/dist/templates/LICENSE.md +15 -0
- package/dist/templates/Makefile +16 -0
- package/dist/templates/README.md.hbs +111 -0
- package/dist/templates/apps/.env.example.hbs +75 -0
- package/dist/templates/apps/hardhat/.prettierrc +16 -0
- package/dist/templates/apps/hardhat/MOCK_USDT_README.md +20 -0
- package/dist/templates/apps/hardhat/Makefile +13 -0
- package/dist/templates/apps/hardhat/README.md +129 -0
- package/dist/templates/apps/hardhat/bin/MusdtVerification +4 -0
- package/dist/templates/apps/hardhat/bin/approveDepositOwner +7 -0
- package/dist/templates/apps/hardhat/bin/contractVerification +9 -0
- package/dist/templates/apps/hardhat/bin/deployMockUSDT +7 -0
- package/dist/templates/apps/hardhat/bin/prepadJ.sh +14 -0
- package/dist/templates/apps/hardhat/bin/verifyMockUSDT +7 -0
- package/dist/templates/apps/hardhat/contracts/MockUSDT.sol +47 -0
- package/dist/templates/apps/hardhat/hardhat.config.ts +102 -0
- package/dist/templates/apps/hardhat/package.json +55 -0
- package/dist/templates/apps/hardhat/scripts/approveDepositOwner.ts +22 -0
- package/dist/templates/apps/hardhat/scripts/deployMockUSDT.ts +49 -0
- package/dist/templates/apps/hardhat/scripts/verifyDeployment.ts +93 -0
- package/dist/templates/apps/hardhat/scripts/verifyMockUSDT.ts +52 -0
- package/dist/templates/apps/hardhat/sync-abis.mjs +58 -0
- package/dist/templates/apps/hardhat/test/MockUSDT.test.ts +40 -0
- package/dist/templates/apps/hardhat/tsconfig.json +27 -0
- package/dist/templates/apps/nextjs/.config/kysely.config.ts +36 -0
- package/dist/templates/apps/nextjs/Makefile +24 -0
- package/dist/templates/apps/nextjs/README.md.hbs +76 -0
- package/dist/templates/apps/nextjs/abis/IERC20.json +74 -0
- package/dist/templates/apps/nextjs/abis/MockUSDT.json +242 -0
- package/dist/templates/apps/nextjs/abis/ReentrancyGuard.json +1 -0
- package/dist/templates/apps/nextjs/app/globals.css +3 -0
- package/dist/templates/apps/nextjs/app/layout.tsx.hbs +26 -0
- package/dist/templates/apps/nextjs/app/page.tsx.hbs +225 -0
- package/dist/templates/apps/nextjs/app/testui/page.tsx +371 -0
- package/dist/templates/apps/nextjs/bin/m +8 -0
- package/dist/templates/apps/nextjs/components.json +21 -0
- package/dist/templates/apps/nextjs/next-env.d.ts +5 -0
- package/dist/templates/apps/nextjs/next.config.ts +10 -0
- package/dist/templates/apps/nextjs/package.json.hbs +48 -0
- package/dist/templates/apps/nextjs/pnpm-workspace.yaml +13 -0
- package/dist/templates/apps/nextjs/postcss.config.mjs +6 -0
- package/dist/templates/apps/nextjs/tailwind.config.js +11 -0
- package/dist/templates/apps/nextjs/tests/helpers.ts +31 -0
- package/dist/templates/apps/nextjs/tests/index.test.ts +7 -0
- package/dist/templates/apps/nextjs/tests/setup-env.ts.hbs +8 -0
- package/dist/templates/apps/nextjs/tests/test-utils.example.test.ts +168 -0
- package/dist/templates/apps/nextjs/tsconfig.json +44 -0
- package/dist/templates/apps/nextjs/tsconfig.test.json +38 -0
- package/dist/templates/apps/nextjs/vitest.config.ts +13 -0
- package/dist/test-utils/fs-mocks.d.ts +32 -0
- package/dist/test-utils/fs-mocks.d.ts.map +1 -0
- package/dist/test-utils/fs-mocks.js +63 -0
- package/dist/test-utils/i18n-mock.d.ts +21 -0
- package/dist/test-utils/i18n-mock.d.ts.map +1 -0
- package/dist/test-utils/i18n-mock.js +29 -0
- package/dist/test-utils/index.d.ts +12 -0
- package/dist/test-utils/index.d.ts.map +1 -0
- package/dist/test-utils/index.js +11 -0
- package/dist/test-utils/kysely-mocks.d.ts +298 -0
- package/dist/test-utils/kysely-mocks.d.ts.map +1 -0
- package/dist/test-utils/kysely-mocks.js +173 -0
- package/dist/test-utils/radix-mocks.d.ts +134 -0
- package/dist/test-utils/radix-mocks.d.ts.map +1 -0
- package/dist/test-utils/radix-mocks.js +175 -0
- package/dist/test-utils/rainbowkit-mocks.d.ts +80 -0
- package/dist/test-utils/rainbowkit-mocks.d.ts.map +1 -0
- package/dist/test-utils/rainbowkit-mocks.js +247 -0
- package/dist/test-utils/viem-mocks.d.ts +86 -0
- package/dist/test-utils/viem-mocks.d.ts.map +1 -0
- package/dist/test-utils/viem-mocks.js +54 -0
- package/dist/util/cli-parser.d.ts +20 -0
- package/dist/util/cli-parser.d.ts.map +1 -0
- package/dist/util/cli-parser.js +38 -0
- package/dist/util/colors.d.ts +5 -0
- package/dist/util/colors.d.ts.map +1 -0
- package/dist/util/colors.js +5 -0
- package/dist/util/locale.d.ts +3 -0
- package/dist/util/locale.d.ts.map +1 -0
- package/dist/util/locale.js +10 -0
- package/dist/wba/client.d.ts +19 -0
- package/dist/wba/client.d.ts.map +1 -0
- package/dist/wba/client.js +31 -0
- package/dist/wba/index.d.ts +4 -0
- package/dist/wba/index.d.ts.map +1 -0
- package/dist/wba/index.js +2 -0
- package/dist/wba/routes/event.d.ts +32 -0
- package/dist/wba/routes/event.d.ts.map +1 -0
- package/dist/wba/routes/event.js +42 -0
- package/dist/wba/routes/index.d.ts +3 -0
- package/dist/wba/routes/index.d.ts.map +1 -0
- package/dist/wba/routes/index.js +2 -0
- package/dist/wba/routes/summary.d.ts +44 -0
- package/dist/wba/routes/summary.d.ts.map +1 -0
- package/dist/wba/routes/summary.js +146 -0
- package/dist/wba/server.d.ts +18 -0
- package/dist/wba/server.d.ts.map +1 -0
- package/dist/wba/server.js +29 -0
- package/dist/wba/types.d.ts +68 -0
- package/dist/wba/types.d.ts.map +1 -0
- package/dist/wba/types.js +6 -0
- package/package.json +223 -0
- package/src/blockchain/README.md +80 -0
- package/src/debug/README.md +94 -0
- package/src/e2e/README.md +105 -0
- package/src/i18n/README.md +143 -0
- package/src/shadcn_components/README.md +125 -0
- package/src/tasks/README.md +69 -0
- package/src/test-utils/README.md +638 -0
- package/src/util/README.md +18 -0
- package/src/wba/README.md +175 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database mocking utilities for tests
|
|
3
|
+
*
|
|
4
|
+
* "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Creates a mock Kysely instance with configurable behavior
|
|
8
|
+
*
|
|
9
|
+
* @param options Configuration for mock behavior
|
|
10
|
+
* @returns Object containing mocked Kysely instance and helper functions
|
|
11
|
+
*/
|
|
12
|
+
export declare function createMockKysely(options?: {
|
|
13
|
+
executeTakeFirst?: any;
|
|
14
|
+
execute?: any;
|
|
15
|
+
sqlExecute?: any;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated No funciona por hoisting de vi.mock().
|
|
18
|
+
* Usa skipConfigMock: true y agrega tu propio vi.mock() manual.
|
|
19
|
+
*/
|
|
20
|
+
configPath?: string;
|
|
21
|
+
/** Whether to skip mocking the config module (default: false) */
|
|
22
|
+
skipConfigMock?: boolean;
|
|
23
|
+
}): {
|
|
24
|
+
MockKysely: {
|
|
25
|
+
new (): {
|
|
26
|
+
selectFrom(): /*elided*/ any;
|
|
27
|
+
where(): /*elided*/ any;
|
|
28
|
+
selectAll(): /*elided*/ any;
|
|
29
|
+
select(...args: any[]): /*elided*/ any;
|
|
30
|
+
orderBy(): /*elided*/ any;
|
|
31
|
+
limit(): /*elided*/ any;
|
|
32
|
+
groupBy(): /*elided*/ any;
|
|
33
|
+
having(): /*elided*/ any;
|
|
34
|
+
leftJoin(): /*elided*/ any;
|
|
35
|
+
innerJoin(): /*elided*/ any;
|
|
36
|
+
insertInto(): /*elided*/ any;
|
|
37
|
+
values(): /*elided*/ any;
|
|
38
|
+
returningAll(): /*elided*/ any;
|
|
39
|
+
updateTable(): /*elided*/ any;
|
|
40
|
+
set(): /*elided*/ any;
|
|
41
|
+
deleteFrom(): /*elided*/ any;
|
|
42
|
+
with(): /*elided*/ any;
|
|
43
|
+
transaction(): {
|
|
44
|
+
execute: (callback: any) => Promise<any>;
|
|
45
|
+
};
|
|
46
|
+
executeTakeFirst(): any;
|
|
47
|
+
executeTakeFirstOrThrow(): any;
|
|
48
|
+
execute(): any;
|
|
49
|
+
getExecutor(): {
|
|
50
|
+
executeQuery: (query: any) => any;
|
|
51
|
+
provideConnection: (callback: any) => Promise<any>;
|
|
52
|
+
releaseConnection: () => void;
|
|
53
|
+
transformQuery: (query: any, transformer: any) => any;
|
|
54
|
+
compileQuery: (query: any, ctx: any) => {
|
|
55
|
+
sql: string;
|
|
56
|
+
parameters: never[];
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
fn: {
|
|
60
|
+
countAll: import("vitest").Mock<() => {
|
|
61
|
+
as: import("vitest").Mock<() => {}>;
|
|
62
|
+
}>;
|
|
63
|
+
sum: import("vitest").Mock<() => {
|
|
64
|
+
as: import("vitest").Mock<() => {}>;
|
|
65
|
+
}>;
|
|
66
|
+
avg: import("vitest").Mock<() => {
|
|
67
|
+
as: import("vitest").Mock<() => {}>;
|
|
68
|
+
}>;
|
|
69
|
+
max: import("vitest").Mock<() => {
|
|
70
|
+
as: import("vitest").Mock<() => {}>;
|
|
71
|
+
}>;
|
|
72
|
+
min: import("vitest").Mock<() => {
|
|
73
|
+
as: import("vitest").Mock<() => {}>;
|
|
74
|
+
}>;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
mockExecuteTakeFirst: import("vitest").Mock<(...args: any[]) => any>;
|
|
79
|
+
mockExecute: import("vitest").Mock<(...args: any[]) => any>;
|
|
80
|
+
mockSqlExecute: import("vitest").Mock<(...args: any[]) => any>;
|
|
81
|
+
mockSql: import("vitest").Mock<() => {
|
|
82
|
+
as: import("vitest").Mock<(...args: any[]) => any>;
|
|
83
|
+
execute: import("vitest").Mock<(...args: any[]) => any>;
|
|
84
|
+
val: import("vitest").Mock<(val: any) => any>;
|
|
85
|
+
}>;
|
|
86
|
+
mockPgPool: import("vitest").Mock<(...args: any[]) => any>;
|
|
87
|
+
/**
|
|
88
|
+
* Setup vi.mock calls for Kysely and related modules
|
|
89
|
+
* Call this in your test file's setup
|
|
90
|
+
*/
|
|
91
|
+
setupMocks(): void;
|
|
92
|
+
/**
|
|
93
|
+
* Reset all mock implementations
|
|
94
|
+
*/
|
|
95
|
+
resetMocks(): void;
|
|
96
|
+
/**
|
|
97
|
+
* Set up common mock responses for database queries
|
|
98
|
+
*/
|
|
99
|
+
setupCommonResponses(): void;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Pre-configured mock for database operations in API routes
|
|
103
|
+
*/
|
|
104
|
+
export declare const apiDbMocks: {
|
|
105
|
+
MockKysely: {
|
|
106
|
+
new (): {
|
|
107
|
+
selectFrom(): /*elided*/ any;
|
|
108
|
+
where(): /*elided*/ any;
|
|
109
|
+
selectAll(): /*elided*/ any;
|
|
110
|
+
select(...args: any[]): /*elided*/ any;
|
|
111
|
+
orderBy(): /*elided*/ any;
|
|
112
|
+
limit(): /*elided*/ any;
|
|
113
|
+
groupBy(): /*elided*/ any;
|
|
114
|
+
having(): /*elided*/ any;
|
|
115
|
+
leftJoin(): /*elided*/ any;
|
|
116
|
+
innerJoin(): /*elided*/ any;
|
|
117
|
+
insertInto(): /*elided*/ any;
|
|
118
|
+
values(): /*elided*/ any;
|
|
119
|
+
returningAll(): /*elided*/ any;
|
|
120
|
+
updateTable(): /*elided*/ any;
|
|
121
|
+
set(): /*elided*/ any;
|
|
122
|
+
deleteFrom(): /*elided*/ any;
|
|
123
|
+
with(): /*elided*/ any;
|
|
124
|
+
transaction(): {
|
|
125
|
+
execute: (callback: any) => Promise<any>;
|
|
126
|
+
};
|
|
127
|
+
executeTakeFirst(): any;
|
|
128
|
+
executeTakeFirstOrThrow(): any;
|
|
129
|
+
execute(): any;
|
|
130
|
+
getExecutor(): {
|
|
131
|
+
executeQuery: (query: any) => any;
|
|
132
|
+
provideConnection: (callback: any) => Promise<any>;
|
|
133
|
+
releaseConnection: () => void;
|
|
134
|
+
transformQuery: (query: any, transformer: any) => any;
|
|
135
|
+
compileQuery: (query: any, ctx: any) => {
|
|
136
|
+
sql: string;
|
|
137
|
+
parameters: never[];
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
fn: {
|
|
141
|
+
countAll: import("vitest").Mock<() => {
|
|
142
|
+
as: import("vitest").Mock<() => {}>;
|
|
143
|
+
}>;
|
|
144
|
+
sum: import("vitest").Mock<() => {
|
|
145
|
+
as: import("vitest").Mock<() => {}>;
|
|
146
|
+
}>;
|
|
147
|
+
avg: import("vitest").Mock<() => {
|
|
148
|
+
as: import("vitest").Mock<() => {}>;
|
|
149
|
+
}>;
|
|
150
|
+
max: import("vitest").Mock<() => {
|
|
151
|
+
as: import("vitest").Mock<() => {}>;
|
|
152
|
+
}>;
|
|
153
|
+
min: import("vitest").Mock<() => {
|
|
154
|
+
as: import("vitest").Mock<() => {}>;
|
|
155
|
+
}>;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
mockExecuteTakeFirst: import("vitest").Mock<(...args: any[]) => any>;
|
|
160
|
+
mockExecute: import("vitest").Mock<(...args: any[]) => any>;
|
|
161
|
+
mockSqlExecute: import("vitest").Mock<(...args: any[]) => any>;
|
|
162
|
+
mockSql: import("vitest").Mock<() => {
|
|
163
|
+
as: import("vitest").Mock<(...args: any[]) => any>;
|
|
164
|
+
execute: import("vitest").Mock<(...args: any[]) => any>;
|
|
165
|
+
val: import("vitest").Mock<(val: any) => any>;
|
|
166
|
+
}>;
|
|
167
|
+
mockPgPool: import("vitest").Mock<(...args: any[]) => any>;
|
|
168
|
+
/**
|
|
169
|
+
* Setup vi.mock calls for Kysely and related modules
|
|
170
|
+
* Call this in your test file's setup
|
|
171
|
+
*/
|
|
172
|
+
setupMocks(): void;
|
|
173
|
+
/**
|
|
174
|
+
* Reset all mock implementations
|
|
175
|
+
*/
|
|
176
|
+
resetMocks(): void;
|
|
177
|
+
/**
|
|
178
|
+
* Set up common mock responses for database queries
|
|
179
|
+
*/
|
|
180
|
+
setupCommonResponses(): void;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Pre-configured mock for database operations in lib functions
|
|
184
|
+
*/
|
|
185
|
+
export declare const libDbMocks: {
|
|
186
|
+
MockKysely: {
|
|
187
|
+
new (): {
|
|
188
|
+
selectFrom(): /*elided*/ any;
|
|
189
|
+
where(): /*elided*/ any;
|
|
190
|
+
selectAll(): /*elided*/ any;
|
|
191
|
+
select(...args: any[]): /*elided*/ any;
|
|
192
|
+
orderBy(): /*elided*/ any;
|
|
193
|
+
limit(): /*elided*/ any;
|
|
194
|
+
groupBy(): /*elided*/ any;
|
|
195
|
+
having(): /*elided*/ any;
|
|
196
|
+
leftJoin(): /*elided*/ any;
|
|
197
|
+
innerJoin(): /*elided*/ any;
|
|
198
|
+
insertInto(): /*elided*/ any;
|
|
199
|
+
values(): /*elided*/ any;
|
|
200
|
+
returningAll(): /*elided*/ any;
|
|
201
|
+
updateTable(): /*elided*/ any;
|
|
202
|
+
set(): /*elided*/ any;
|
|
203
|
+
deleteFrom(): /*elided*/ any;
|
|
204
|
+
with(): /*elided*/ any;
|
|
205
|
+
transaction(): {
|
|
206
|
+
execute: (callback: any) => Promise<any>;
|
|
207
|
+
};
|
|
208
|
+
executeTakeFirst(): any;
|
|
209
|
+
executeTakeFirstOrThrow(): any;
|
|
210
|
+
execute(): any;
|
|
211
|
+
getExecutor(): {
|
|
212
|
+
executeQuery: (query: any) => any;
|
|
213
|
+
provideConnection: (callback: any) => Promise<any>;
|
|
214
|
+
releaseConnection: () => void;
|
|
215
|
+
transformQuery: (query: any, transformer: any) => any;
|
|
216
|
+
compileQuery: (query: any, ctx: any) => {
|
|
217
|
+
sql: string;
|
|
218
|
+
parameters: never[];
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
fn: {
|
|
222
|
+
countAll: import("vitest").Mock<() => {
|
|
223
|
+
as: import("vitest").Mock<() => {}>;
|
|
224
|
+
}>;
|
|
225
|
+
sum: import("vitest").Mock<() => {
|
|
226
|
+
as: import("vitest").Mock<() => {}>;
|
|
227
|
+
}>;
|
|
228
|
+
avg: import("vitest").Mock<() => {
|
|
229
|
+
as: import("vitest").Mock<() => {}>;
|
|
230
|
+
}>;
|
|
231
|
+
max: import("vitest").Mock<() => {
|
|
232
|
+
as: import("vitest").Mock<() => {}>;
|
|
233
|
+
}>;
|
|
234
|
+
min: import("vitest").Mock<() => {
|
|
235
|
+
as: import("vitest").Mock<() => {}>;
|
|
236
|
+
}>;
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
mockExecuteTakeFirst: import("vitest").Mock<(...args: any[]) => any>;
|
|
241
|
+
mockExecute: import("vitest").Mock<(...args: any[]) => any>;
|
|
242
|
+
mockSqlExecute: import("vitest").Mock<(...args: any[]) => any>;
|
|
243
|
+
mockSql: import("vitest").Mock<() => {
|
|
244
|
+
as: import("vitest").Mock<(...args: any[]) => any>;
|
|
245
|
+
execute: import("vitest").Mock<(...args: any[]) => any>;
|
|
246
|
+
val: import("vitest").Mock<(val: any) => any>;
|
|
247
|
+
}>;
|
|
248
|
+
mockPgPool: import("vitest").Mock<(...args: any[]) => any>;
|
|
249
|
+
/**
|
|
250
|
+
* Setup vi.mock calls for Kysely and related modules
|
|
251
|
+
* Call this in your test file's setup
|
|
252
|
+
*/
|
|
253
|
+
setupMocks(): void;
|
|
254
|
+
/**
|
|
255
|
+
* Reset all mock implementations
|
|
256
|
+
*/
|
|
257
|
+
resetMocks(): void;
|
|
258
|
+
/**
|
|
259
|
+
* Set up common mock responses for database queries
|
|
260
|
+
*/
|
|
261
|
+
setupCommonResponses(): void;
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* Creates a simple flat mock DB object for use in `vi.mock` factories.
|
|
265
|
+
* Use when you just need a mock object with chainable methods,
|
|
266
|
+
* not the full Kysely builder.
|
|
267
|
+
*
|
|
268
|
+
* ```typescript
|
|
269
|
+
* const mockDb = vi.hoisted(() => undefined as any)
|
|
270
|
+
* beforeEach(() => { if (!mockDb) Object.assign(mockDb, createMockDb()) })
|
|
271
|
+
* vi.mock('@/.config/kysely.config', () => ({ newKyselyPostgresql: () => mockDb }))
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
export declare function createMockDb(): {
|
|
275
|
+
selectFrom: import("vitest").Mock<(...args: any[]) => any>;
|
|
276
|
+
select: import("vitest").Mock<(...args: any[]) => any>;
|
|
277
|
+
selectAll: import("vitest").Mock<(...args: any[]) => any>;
|
|
278
|
+
where: import("vitest").Mock<(...args: any[]) => any>;
|
|
279
|
+
orderBy: import("vitest").Mock<(...args: any[]) => any>;
|
|
280
|
+
limit: import("vitest").Mock<(...args: any[]) => any>;
|
|
281
|
+
groupBy: import("vitest").Mock<(...args: any[]) => any>;
|
|
282
|
+
having: import("vitest").Mock<(...args: any[]) => any>;
|
|
283
|
+
leftJoin: import("vitest").Mock<(...args: any[]) => any>;
|
|
284
|
+
innerJoin: import("vitest").Mock<(...args: any[]) => any>;
|
|
285
|
+
executeTakeFirst: import("vitest").Mock<(...args: any[]) => any>;
|
|
286
|
+
executeTakeFirstOrThrow: import("vitest").Mock<(...args: any[]) => any>;
|
|
287
|
+
insertInto: import("vitest").Mock<(...args: any[]) => any>;
|
|
288
|
+
values: import("vitest").Mock<(...args: any[]) => any>;
|
|
289
|
+
returningAll: import("vitest").Mock<(...args: any[]) => any>;
|
|
290
|
+
updateTable: import("vitest").Mock<(...args: any[]) => any>;
|
|
291
|
+
set: import("vitest").Mock<(...args: any[]) => any>;
|
|
292
|
+
deleteFrom: import("vitest").Mock<(...args: any[]) => any>;
|
|
293
|
+
with: import("vitest").Mock<(...args: any[]) => any>;
|
|
294
|
+
onConflict: import("vitest").Mock<(...args: any[]) => any>;
|
|
295
|
+
execute: import("vitest").Mock<(...args: any[]) => any>;
|
|
296
|
+
transaction: import("vitest").Mock<(...args: any[]) => any>;
|
|
297
|
+
};
|
|
298
|
+
//# sourceMappingURL=kysely-mocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kysely-mocks.d.ts","sourceRoot":"","sources":["../../src/test-utils/kysely-mocks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE;IACxC,gBAAgB,CAAC,EAAE,GAAG,CAAA;IACtB,OAAO,CAAC,EAAE,GAAG,CAAA;IACb,UAAU,CAAC,EAAE,GAAG,CAAA;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iEAAiE;IACjE,cAAc,CAAC,EAAE,OAAO,CAAA;CACpB;;;;;;4BAqBc,GAAG,EAAE;;;;;;;;;;;;;;;oCAiBS,GAAG;;;;;;sCAWP,GAAG;8CACW,GAAG;;wCAEf,GAAG,eAAe,GAAG;sCACvB,GAAG,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCAgBtB,GAAG;;;IAapB;;;OAGG;;IAqBH;;OAEG;;IASH;;OAEG;;EAQN;AAED;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;4BA/GH,GAAG,EAAE;;;;;;;;;;;;;;;oCAiBS,GAAG;;;;;;sCAWP,GAAG;8CACW,GAAG;;wCAEf,GAAG,eAAe,GAAG;sCACvB,GAAG,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCAgBtB,GAAG;;;IAapB;;;OAGG;;IAqBH;;OAEG;;IASH;;OAEG;;CAaqC,CAAA;AAE5C;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;4BApHH,GAAG,EAAE;;;;;;;;;;;;;;;oCAiBS,GAAG;;;;;;sCAWP,GAAG;8CACW,GAAG;;wCAEf,GAAG,eAAe,GAAG;sCACvB,GAAG,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCAgBtB,GAAG;;;IAapB;;;OAGG;;IAqBH;;OAEG;;IASH;;OAEG;;CAkBqC,CAAA;AAE5C;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY;;;;;;;;;;;;;;;;;;;;;;;EAyB3B"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database mocking utilities for tests
|
|
3
|
+
*
|
|
4
|
+
* "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
|
|
5
|
+
*/
|
|
6
|
+
import { vi } from 'vitest';
|
|
7
|
+
/**
|
|
8
|
+
* Creates a mock Kysely instance with configurable behavior
|
|
9
|
+
*
|
|
10
|
+
* @param options Configuration for mock behavior
|
|
11
|
+
* @returns Object containing mocked Kysely instance and helper functions
|
|
12
|
+
*/
|
|
13
|
+
export function createMockKysely(options = {}) {
|
|
14
|
+
const opts = options;
|
|
15
|
+
const mockExecuteTakeFirst = vi.fn();
|
|
16
|
+
const mockExecute = vi.fn();
|
|
17
|
+
const mockSqlExecute = vi.fn();
|
|
18
|
+
// Apply custom implementations if provided
|
|
19
|
+
if (opts.executeTakeFirst !== undefined) {
|
|
20
|
+
mockExecuteTakeFirst.mockImplementation(options.executeTakeFirst);
|
|
21
|
+
}
|
|
22
|
+
if (opts.execute !== undefined) {
|
|
23
|
+
mockExecute.mockImplementation(options.execute);
|
|
24
|
+
}
|
|
25
|
+
if (opts.sqlExecute !== undefined) {
|
|
26
|
+
mockSqlExecute.mockImplementation(options.sqlExecute);
|
|
27
|
+
}
|
|
28
|
+
class MockKysely {
|
|
29
|
+
selectFrom() { return this; }
|
|
30
|
+
where() { return this; }
|
|
31
|
+
selectAll() { return this; }
|
|
32
|
+
select(...args) { return this; }
|
|
33
|
+
orderBy() { return this; }
|
|
34
|
+
limit() { return this; }
|
|
35
|
+
groupBy() { return this; }
|
|
36
|
+
having() { return this; }
|
|
37
|
+
leftJoin() { return this; }
|
|
38
|
+
innerJoin() { return this; }
|
|
39
|
+
insertInto() { return this; }
|
|
40
|
+
values() { return this; }
|
|
41
|
+
returningAll() { return this; }
|
|
42
|
+
updateTable() { return this; }
|
|
43
|
+
set() { return this; }
|
|
44
|
+
deleteFrom() { return this; }
|
|
45
|
+
with() { return this; }
|
|
46
|
+
transaction() {
|
|
47
|
+
return {
|
|
48
|
+
execute: async (callback) => {
|
|
49
|
+
const mockTrx = new MockKysely();
|
|
50
|
+
return callback(mockTrx);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
executeTakeFirst() { return mockExecuteTakeFirst(); }
|
|
55
|
+
executeTakeFirstOrThrow() { return mockExecuteTakeFirst(); }
|
|
56
|
+
execute() { return mockExecute(); }
|
|
57
|
+
getExecutor() {
|
|
58
|
+
return {
|
|
59
|
+
executeQuery: (query) => mockSqlExecute(query),
|
|
60
|
+
provideConnection: async (callback) => callback({}),
|
|
61
|
+
releaseConnection: () => { },
|
|
62
|
+
transformQuery: (query, transformer) => query,
|
|
63
|
+
compileQuery: (query, ctx) => ({ sql: '', parameters: [] }),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
fn = {
|
|
67
|
+
countAll: vi.fn(() => ({ as: vi.fn(() => ({})) })),
|
|
68
|
+
sum: vi.fn(() => ({ as: vi.fn(() => ({})) })),
|
|
69
|
+
avg: vi.fn(() => ({ as: vi.fn(() => ({})) })),
|
|
70
|
+
max: vi.fn(() => ({ as: vi.fn(() => ({})) })),
|
|
71
|
+
min: vi.fn(() => ({ as: vi.fn(() => ({})) })),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const mockSql = vi.fn(() => ({
|
|
75
|
+
as: vi.fn().mockReturnValue({}),
|
|
76
|
+
execute: mockSqlExecute,
|
|
77
|
+
val: vi.fn((val) => val),
|
|
78
|
+
}));
|
|
79
|
+
const mockPgPool = vi.fn();
|
|
80
|
+
return {
|
|
81
|
+
MockKysely,
|
|
82
|
+
mockExecuteTakeFirst,
|
|
83
|
+
mockExecute,
|
|
84
|
+
mockSqlExecute,
|
|
85
|
+
mockSql,
|
|
86
|
+
mockPgPool,
|
|
87
|
+
/**
|
|
88
|
+
* Setup vi.mock calls for Kysely and related modules
|
|
89
|
+
* Call this in your test file's setup
|
|
90
|
+
*/
|
|
91
|
+
setupMocks() {
|
|
92
|
+
vi.mock('kysely', () => ({
|
|
93
|
+
Kysely: MockKysely,
|
|
94
|
+
PostgresDialect: vi.fn(),
|
|
95
|
+
sql: mockSql,
|
|
96
|
+
}));
|
|
97
|
+
vi.mock('pg', () => ({
|
|
98
|
+
Pool: mockPgPool,
|
|
99
|
+
}));
|
|
100
|
+
// Mock config module only if not skipped
|
|
101
|
+
const skipConfigMock = opts.skipConfigMock || false;
|
|
102
|
+
if (!skipConfigMock) {
|
|
103
|
+
vi.mock('@/.config/kysely.config', () => ({
|
|
104
|
+
newKyselyPostgresql: vi.fn(() => new MockKysely()),
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
/**
|
|
109
|
+
* Reset all mock implementations
|
|
110
|
+
*/
|
|
111
|
+
resetMocks() {
|
|
112
|
+
mockExecuteTakeFirst.mockReset();
|
|
113
|
+
mockExecute.mockReset();
|
|
114
|
+
mockSqlExecute.mockReset();
|
|
115
|
+
mockSql.mockReset();
|
|
116
|
+
mockPgPool.mockReset();
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* Set up common mock responses for database queries
|
|
120
|
+
*/
|
|
121
|
+
setupCommonResponses() {
|
|
122
|
+
// Default empty responses
|
|
123
|
+
mockExecuteTakeFirst.mockResolvedValue(null);
|
|
124
|
+
mockExecute.mockResolvedValue([]);
|
|
125
|
+
mockSqlExecute.mockResolvedValue({ rows: [] });
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Pre-configured mock for database operations in API routes
|
|
131
|
+
*/
|
|
132
|
+
export const apiDbMocks = createMockKysely();
|
|
133
|
+
/**
|
|
134
|
+
* Pre-configured mock for database operations in lib functions
|
|
135
|
+
*/
|
|
136
|
+
export const libDbMocks = createMockKysely();
|
|
137
|
+
/**
|
|
138
|
+
* Creates a simple flat mock DB object for use in `vi.mock` factories.
|
|
139
|
+
* Use when you just need a mock object with chainable methods,
|
|
140
|
+
* not the full Kysely builder.
|
|
141
|
+
*
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const mockDb = vi.hoisted(() => undefined as any)
|
|
144
|
+
* beforeEach(() => { if (!mockDb) Object.assign(mockDb, createMockDb()) })
|
|
145
|
+
* vi.mock('@/.config/kysely.config', () => ({ newKyselyPostgresql: () => mockDb }))
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
export function createMockDb() {
|
|
149
|
+
return {
|
|
150
|
+
selectFrom: vi.fn().mockReturnThis(),
|
|
151
|
+
select: vi.fn().mockReturnThis(),
|
|
152
|
+
selectAll: vi.fn().mockReturnThis(),
|
|
153
|
+
where: vi.fn().mockReturnThis(),
|
|
154
|
+
orderBy: vi.fn().mockReturnThis(),
|
|
155
|
+
limit: vi.fn().mockReturnThis(),
|
|
156
|
+
groupBy: vi.fn().mockReturnThis(),
|
|
157
|
+
having: vi.fn().mockReturnThis(),
|
|
158
|
+
leftJoin: vi.fn().mockReturnThis(),
|
|
159
|
+
innerJoin: vi.fn().mockReturnThis(),
|
|
160
|
+
executeTakeFirst: vi.fn().mockResolvedValue(null),
|
|
161
|
+
executeTakeFirstOrThrow: vi.fn().mockResolvedValue(null),
|
|
162
|
+
insertInto: vi.fn().mockReturnThis(),
|
|
163
|
+
values: vi.fn().mockReturnThis(),
|
|
164
|
+
returningAll: vi.fn().mockReturnThis(),
|
|
165
|
+
updateTable: vi.fn().mockReturnThis(),
|
|
166
|
+
set: vi.fn().mockReturnThis(),
|
|
167
|
+
deleteFrom: vi.fn().mockReturnThis(),
|
|
168
|
+
with: vi.fn().mockReturnThis(),
|
|
169
|
+
onConflict: vi.fn().mockReturnThis(),
|
|
170
|
+
execute: vi.fn().mockResolvedValue(undefined),
|
|
171
|
+
transaction: vi.fn().mockImplementation(async (cb) => cb(createMockDb())),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Radix UI mocks for testing
|
|
3
|
+
*
|
|
4
|
+
* "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
/**
|
|
8
|
+
* Mock for @radix-ui/react-portal
|
|
9
|
+
* Renders children directly instead of in a portal
|
|
10
|
+
*/
|
|
11
|
+
export declare const portalMock: {
|
|
12
|
+
Portal: ({ children }: {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}) => React.ReactNode;
|
|
15
|
+
Root: ({ children }: {
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}) => React.ReactNode;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Mock for @radix-ui/react-menubar
|
|
21
|
+
* Provides simplified components that render without complex context
|
|
22
|
+
*/
|
|
23
|
+
export declare const menubarMock: {
|
|
24
|
+
Root: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
25
|
+
Menu: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
26
|
+
Trigger: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
27
|
+
Content: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
28
|
+
Item: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
29
|
+
Separator: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
30
|
+
Label: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
31
|
+
CheckboxItem: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
32
|
+
RadioGroup: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
33
|
+
RadioItem: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
34
|
+
Group: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
35
|
+
ItemIndicator: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
36
|
+
Sub: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
37
|
+
SubTrigger: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
38
|
+
SubContent: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
39
|
+
Shortcut: ({ className, ...props }: any) => React.JSX.Element;
|
|
40
|
+
Portal: ({ children }: {
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
}) => React.ReactNode;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Mock for @radix-ui/react-popover
|
|
46
|
+
*/
|
|
47
|
+
export declare const popoverMock: {
|
|
48
|
+
Root: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
49
|
+
Trigger: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
50
|
+
Content: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
51
|
+
Portal: ({ children }: {
|
|
52
|
+
children: React.ReactNode;
|
|
53
|
+
}) => React.ReactNode;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Mock for @radix-ui/react-dropdown-menu
|
|
57
|
+
*/
|
|
58
|
+
export declare const dropdownMenuMock: {
|
|
59
|
+
Root: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
60
|
+
Trigger: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
61
|
+
Content: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
62
|
+
Item: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
63
|
+
Separator: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
64
|
+
Label: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
65
|
+
CheckboxItem: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
66
|
+
RadioGroup: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
67
|
+
RadioItem: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
68
|
+
Sub: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
69
|
+
SubTrigger: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
70
|
+
SubContent: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
71
|
+
Shortcut: ({ className, ...props }: any) => React.JSX.Element;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Mock for @radix-ui/react-dialog (used by sheet, alert-dialog)
|
|
75
|
+
*/
|
|
76
|
+
export declare const dialogMock: {
|
|
77
|
+
Root: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
78
|
+
Trigger: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
79
|
+
Content: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
80
|
+
Overlay: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
81
|
+
Title: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
82
|
+
Description: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
83
|
+
Close: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Mock for @radix-ui/react-toast
|
|
87
|
+
*/
|
|
88
|
+
export declare const toastMock: {
|
|
89
|
+
Provider: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
90
|
+
Root: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
91
|
+
Title: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
92
|
+
Description: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
93
|
+
Action: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
94
|
+
Close: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
95
|
+
Viewport: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Mock for @radix-ui/react-tooltip
|
|
99
|
+
*/
|
|
100
|
+
export declare const tooltipMock: {
|
|
101
|
+
Provider: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
102
|
+
Root: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
103
|
+
Trigger: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
104
|
+
Content: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
105
|
+
Arrow: ({ className, ...props }: any) => React.JSX.Element;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Common Radix UI component mocks
|
|
109
|
+
*/
|
|
110
|
+
export declare const commonRadixMocks: {
|
|
111
|
+
Slot: ({ children, ...props }: any) => React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
112
|
+
Label: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
113
|
+
Separator: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
114
|
+
};
|
|
115
|
+
export declare const scrollAreaMock: {
|
|
116
|
+
Root: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
117
|
+
Viewport: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
118
|
+
Scrollbar: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
119
|
+
Thumb: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
120
|
+
ScrollAreaScrollbar: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
121
|
+
Corner: ({ className, ...props }: any) => React.JSX.Element;
|
|
122
|
+
ScrollAreaThumb: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
123
|
+
ScrollAreaViewport: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
124
|
+
ScrollAreaCorner: ({ className, ...props }: any) => React.JSX.Element;
|
|
125
|
+
ScrollAreaRoot: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
126
|
+
};
|
|
127
|
+
export declare const tabsMock: {
|
|
128
|
+
Root: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
129
|
+
List: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
130
|
+
Trigger: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
131
|
+
Content: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
132
|
+
};
|
|
133
|
+
export declare function setupRadixMocks(): void;
|
|
134
|
+
//# sourceMappingURL=radix-mocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radix-mocks.d.ts","sourceRoot":"","sources":["../../src/test-utils/radix-mocks.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAazB;;;GAGG;AACH,eAAO,MAAM,UAAU;2BACE;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;yBAC/B;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;CACnD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;wCAgEc,GAAG;2BAxEhB;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;CA4ErD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;2BAjFC;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;CAoGrD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;wCAuDS,GAAG;CAGxC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;CA8BtB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;CA8BrB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;qCAeW,GAAG;CAGrC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB;mCACI,GAAG;;;CAOnC,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;sCA4BS,GAAG;;;gDASO,GAAG;;CAMhD,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;CAepB,CAAC;AAGF,wBAAgB,eAAe,SA4F9B"}
|