@zuplo/cli 7.11.0 → 7.11.3
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/node_modules/@hono/node-server/README.md +2 -0
- package/node_modules/@hono/node-server/dist/index.cjs +1 -1
- package/node_modules/@hono/node-server/dist/index.mjs +1 -1
- package/node_modules/@hono/node-server/dist/serve-static.cjs +2 -1
- package/node_modules/@hono/node-server/dist/serve-static.mjs +2 -1
- package/node_modules/@hono/node-server/package.json +1 -1
- package/node_modules/@posthog/core/dist/metrics/index.d.ts +9 -0
- package/node_modules/@posthog/core/dist/metrics/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/metrics/index.js +38 -3
- package/node_modules/@posthog/core/dist/metrics/index.mjs +38 -3
- package/node_modules/@posthog/core/dist/metrics/types.d.ts +7 -2
- package/node_modules/@posthog/core/dist/metrics/types.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/traces/ids.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/traces/ids.js +2 -2
- package/node_modules/@posthog/core/dist/traces/ids.mjs +2 -2
- package/node_modules/@posthog/core/package.json +2 -2
- package/node_modules/@posthog/core/src/metrics/index.spec.ts +75 -0
- package/node_modules/@posthog/core/src/metrics/index.ts +60 -0
- package/node_modules/@posthog/core/src/metrics/types.ts +7 -1
- package/node_modules/@posthog/core/src/traces/ids.ts +4 -2
- package/node_modules/@posthog/types/dist/capture-metric.d.ts +10 -0
- package/node_modules/@posthog/types/dist/capture-metric.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/index.d.ts +1 -1
- package/node_modules/@posthog/types/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/capture-metric.ts +11 -0
- package/node_modules/@posthog/types/src/index.ts +1 -0
- package/node_modules/@zuplo/core/customer.cli.minified.js +80 -80
- package/node_modules/@zuplo/core/index.minified.js +85 -85
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +5 -2
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ2BHVUH.js → chunk-CDEAY3VY.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/chunk-LVSZ3WTO.js +37 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-LVSZ3WTO.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-VTO3F6DK.js → chunk-NUVXDVLJ.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-6YPRGG62.js → chunk-TPYCFLC7.js} +109 -109
- package/node_modules/@zuplo/runtime/out/esm/chunk-TPYCFLC7.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +43 -43
- package/node_modules/@zuplo/runtime/out/types/internal/index.d.ts +14 -0
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/package.json +15 -12
- package/dist/__tests__/archive-utils.test.d.ts +0 -2
- package/dist/__tests__/archive-utils.test.d.ts.map +0 -1
- package/dist/__tests__/archive-utils.test.js +0 -50
- package/dist/__tests__/archive-utils.test.js.map +0 -1
- package/dist/__tests__/import-openapi.test.d.ts +0 -2
- package/dist/__tests__/import-openapi.test.d.ts.map +0 -1
- package/dist/__tests__/import-openapi.test.js +0 -251
- package/dist/__tests__/import-openapi.test.js.map +0 -1
- package/dist/__tests__/integration/confirm-linked-config.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/confirm-linked-config.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/confirm-linked-config.integration.test.js +0 -202
- package/dist/__tests__/integration/confirm-linked-config.integration.test.js.map +0 -1
- package/dist/__tests__/integration/confirm-production-deploy.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/confirm-production-deploy.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/confirm-production-deploy.integration.test.js +0 -184
- package/dist/__tests__/integration/confirm-production-deploy.integration.test.js.map +0 -1
- package/dist/__tests__/integration/custom-domain.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/custom-domain.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/custom-domain.integration.test.js +0 -563
- package/dist/__tests__/integration/custom-domain.integration.test.js.map +0 -1
- package/dist/__tests__/integration/delete.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/delete.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/delete.integration.test.js +0 -262
- package/dist/__tests__/integration/delete.integration.test.js.map +0 -1
- package/dist/__tests__/integration/deploy.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/deploy.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/deploy.integration.test.js +0 -519
- package/dist/__tests__/integration/deploy.integration.test.js.map +0 -1
- package/dist/__tests__/integration/get-project-param.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/get-project-param.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/get-project-param.integration.test.js +0 -305
- package/dist/__tests__/integration/get-project-param.integration.test.js.map +0 -1
- package/dist/__tests__/integration/info.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/info.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/info.integration.test.js +0 -293
- package/dist/__tests__/integration/info.integration.test.js.map +0 -1
- package/dist/__tests__/integration/jest-mocks-setup.d.ts +0 -2
- package/dist/__tests__/integration/jest-mocks-setup.d.ts.map +0 -1
- package/dist/__tests__/integration/jest-mocks-setup.js +0 -104
- package/dist/__tests__/integration/jest-mocks-setup.js.map +0 -1
- package/dist/__tests__/integration/jest-setup.d.ts +0 -2
- package/dist/__tests__/integration/jest-setup.d.ts.map +0 -1
- package/dist/__tests__/integration/jest-setup.js +0 -12
- package/dist/__tests__/integration/jest-setup.js.map +0 -1
- package/dist/__tests__/integration/link.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/link.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/link.integration.test.js +0 -395
- package/dist/__tests__/integration/link.integration.test.js.map +0 -1
- package/dist/__tests__/integration/linked-config-cascade.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/linked-config-cascade.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/linked-config-cascade.integration.test.js +0 -179
- package/dist/__tests__/integration/linked-config-cascade.integration.test.js.map +0 -1
- package/dist/__tests__/integration/list.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/list.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/list.integration.test.js +0 -300
- package/dist/__tests__/integration/list.integration.test.js.map +0 -1
- package/dist/__tests__/integration/source-upgrade.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/source-upgrade.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/source-upgrade.integration.test.js +0 -100
- package/dist/__tests__/integration/source-upgrade.integration.test.js.map +0 -1
- package/dist/__tests__/integration/test-utils.d.ts +0 -30
- package/dist/__tests__/integration/test-utils.d.ts.map +0 -1
- package/dist/__tests__/integration/test-utils.js +0 -82
- package/dist/__tests__/integration/test-utils.js.map +0 -1
- package/dist/__tests__/integration/tunnel.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/tunnel.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/tunnel.integration.test.js +0 -486
- package/dist/__tests__/integration/tunnel.integration.test.js.map +0 -1
- package/dist/__tests__/integration/variable.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/variable.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/variable.integration.test.js +0 -258
- package/dist/__tests__/integration/variable.integration.test.js.map +0 -1
- package/dist/__tests__/integration/whoami.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/whoami.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/whoami.integration.test.js +0 -116
- package/dist/__tests__/integration/whoami.integration.test.js.map +0 -1
- package/dist/__tests__/outdated.test.d.ts +0 -2
- package/dist/__tests__/outdated.test.d.ts.map +0 -1
- package/dist/__tests__/outdated.test.js +0 -67
- package/dist/__tests__/outdated.test.js.map +0 -1
- package/dist/__tests__/populate.test.d.ts +0 -2
- package/dist/__tests__/populate.test.d.ts.map +0 -1
- package/dist/__tests__/populate.test.js +0 -445
- package/dist/__tests__/populate.test.js.map +0 -1
- package/dist/__tests__/tsconfig-upgrader.test.d.ts +0 -2
- package/dist/__tests__/tsconfig-upgrader.test.d.ts.map +0 -1
- package/dist/__tests__/tsconfig-upgrader.test.js +0 -31
- package/dist/__tests__/tsconfig-upgrader.test.js.map +0 -1
- package/dist/ca-certificate/validation.test.d.ts +0 -2
- package/dist/ca-certificate/validation.test.d.ts.map +0 -1
- package/dist/ca-certificate/validation.test.js +0 -131
- package/dist/ca-certificate/validation.test.js.map +0 -1
- package/dist/common/analytics/cli-invocation.test.d.ts +0 -2
- package/dist/common/analytics/cli-invocation.test.d.ts.map +0 -1
- package/dist/common/analytics/cli-invocation.test.js +0 -51
- package/dist/common/analytics/cli-invocation.test.js.map +0 -1
- package/dist/common/analytics/package-manager.test.d.ts +0 -2
- package/dist/common/analytics/package-manager.test.d.ts.map +0 -1
- package/dist/common/analytics/package-manager.test.js +0 -163
- package/dist/common/analytics/package-manager.test.js.map +0 -1
- package/dist/common/cli-dispatcher.test.d.ts +0 -2
- package/dist/common/cli-dispatcher.test.d.ts.map +0 -1
- package/dist/common/cli-dispatcher.test.js +0 -80
- package/dist/common/cli-dispatcher.test.js.map +0 -1
- package/dist/common/middleware/check-pnpm-lifecycle.test.d.ts +0 -2
- package/dist/common/middleware/check-pnpm-lifecycle.test.d.ts.map +0 -1
- package/dist/common/middleware/check-pnpm-lifecycle.test.js +0 -125
- package/dist/common/middleware/check-pnpm-lifecycle.test.js.map +0 -1
- package/dist/common/middleware/get-environment-param.test.d.ts +0 -2
- package/dist/common/middleware/get-environment-param.test.d.ts.map +0 -1
- package/dist/common/middleware/get-environment-param.test.js +0 -57
- package/dist/common/middleware/get-environment-param.test.js.map +0 -1
- package/dist/common/read-linked-config.test.d.ts +0 -2
- package/dist/common/read-linked-config.test.d.ts.map +0 -1
- package/dist/common/read-linked-config.test.js +0 -363
- package/dist/common/read-linked-config.test.js.map +0 -1
- package/dist/common/terminal.test.d.ts +0 -2
- package/dist/common/terminal.test.d.ts.map +0 -1
- package/dist/common/terminal.test.js +0 -101
- package/dist/common/terminal.test.js.map +0 -1
- package/dist/common/utils/build-environment-prompt-choices.test.d.ts +0 -2
- package/dist/common/utils/build-environment-prompt-choices.test.d.ts.map +0 -1
- package/dist/common/utils/build-environment-prompt-choices.test.js +0 -97
- package/dist/common/utils/build-environment-prompt-choices.test.js.map +0 -1
- package/dist/common/utils/format-environment-type.test.d.ts +0 -2
- package/dist/common/utils/format-environment-type.test.d.ts.map +0 -1
- package/dist/common/utils/format-environment-type.test.js +0 -32
- package/dist/common/utils/format-environment-type.test.js.map +0 -1
- package/dist/common/utils/pnpm-lifecycle.test.d.ts +0 -2
- package/dist/common/utils/pnpm-lifecycle.test.d.ts.map +0 -1
- package/dist/common/utils/pnpm-lifecycle.test.js +0 -196
- package/dist/common/utils/pnpm-lifecycle.test.js.map +0 -1
- package/dist/common/utils/pretty-print-environment-prompt.test.d.ts +0 -2
- package/dist/common/utils/pretty-print-environment-prompt.test.d.ts.map +0 -1
- package/dist/common/utils/pretty-print-environment-prompt.test.js +0 -42
- package/dist/common/utils/pretty-print-environment-prompt.test.js.map +0 -1
- package/dist/common/utils/sort-environments-for-prompt.test.d.ts +0 -2
- package/dist/common/utils/sort-environments-for-prompt.test.d.ts.map +0 -1
- package/dist/common/utils/sort-environments-for-prompt.test.js +0 -82
- package/dist/common/utils/sort-environments-for-prompt.test.js.map +0 -1
- package/dist/common/utils/stringify-config.test.d.ts +0 -2
- package/dist/common/utils/stringify-config.test.d.ts.map +0 -1
- package/dist/common/utils/stringify-config.test.js +0 -80
- package/dist/common/utils/stringify-config.test.js.map +0 -1
- package/dist/common/validators/argument-validators.spec.d.ts +0 -2
- package/dist/common/validators/argument-validators.spec.d.ts.map +0 -1
- package/dist/common/validators/argument-validators.spec.js +0 -181
- package/dist/common/validators/argument-validators.spec.js.map +0 -1
- package/dist/common/worker-output.test.d.ts +0 -2
- package/dist/common/worker-output.test.d.ts.map +0 -1
- package/dist/common/worker-output.test.js +0 -32
- package/dist/common/worker-output.test.js.map +0 -1
- package/dist/deploy/archive.local-registry.test.d.ts +0 -2
- package/dist/deploy/archive.local-registry.test.d.ts.map +0 -1
- package/dist/deploy/archive.local-registry.test.js +0 -100
- package/dist/deploy/archive.local-registry.test.js.map +0 -1
- package/dist/deploy/archive.test.d.ts +0 -2
- package/dist/deploy/archive.test.d.ts.map +0 -1
- package/dist/deploy/archive.test.js +0 -248
- package/dist/deploy/archive.test.js.map +0 -1
- package/dist/deploy/classify-build-probe.test.d.ts +0 -2
- package/dist/deploy/classify-build-probe.test.d.ts.map +0 -1
- package/dist/deploy/classify-build-probe.test.js +0 -51
- package/dist/deploy/classify-build-probe.test.js.map +0 -1
- package/dist/deploy/poll-deployment.test.d.ts +0 -2
- package/dist/deploy/poll-deployment.test.d.ts.map +0 -1
- package/dist/deploy/poll-deployment.test.js +0 -158
- package/dist/deploy/poll-deployment.test.js.map +0 -1
- package/dist/dev/zuplo-local-gitignore.test.d.ts +0 -2
- package/dist/dev/zuplo-local-gitignore.test.d.ts.map +0 -1
- package/dist/dev/zuplo-local-gitignore.test.js +0 -58
- package/dist/dev/zuplo-local-gitignore.test.js.map +0 -1
- package/dist/editor/e2e/editor.spec.d.ts +0 -2
- package/dist/editor/e2e/editor.spec.d.ts.map +0 -1
- package/dist/editor/e2e/editor.spec.js +0 -44
- package/dist/editor/e2e/editor.spec.js.map +0 -1
- package/dist/link/project-type.test.d.ts +0 -2
- package/dist/link/project-type.test.d.ts.map +0 -1
- package/dist/link/project-type.test.js +0 -225
- package/dist/link/project-type.test.js.map +0 -1
- package/dist/lint/resolve-binary.test.d.ts +0 -2
- package/dist/lint/resolve-binary.test.d.ts.map +0 -1
- package/dist/lint/resolve-binary.test.js +0 -155
- package/dist/lint/resolve-binary.test.js.map +0 -1
- package/dist/open-api/convert/handler.spec.d.ts +0 -2
- package/dist/open-api/convert/handler.spec.d.ts.map +0 -1
- package/dist/open-api/convert/handler.spec.js +0 -301
- package/dist/open-api/convert/handler.spec.js.map +0 -1
- package/dist/open-api/merge/handler.spec.d.ts +0 -2
- package/dist/open-api/merge/handler.spec.d.ts.map +0 -1
- package/dist/open-api/merge/handler.spec.js +0 -673
- package/dist/open-api/merge/handler.spec.js.map +0 -1
- package/dist/open-api/overlay/handler.spec.d.ts +0 -2
- package/dist/open-api/overlay/handler.spec.d.ts.map +0 -1
- package/dist/open-api/overlay/handler.spec.js +0 -346
- package/dist/open-api/overlay/handler.spec.js.map +0 -1
- package/dist/source/ai-gateway/files.test.d.ts +0 -2
- package/dist/source/ai-gateway/files.test.d.ts.map +0 -1
- package/dist/source/ai-gateway/files.test.js +0 -135
- package/dist/source/ai-gateway/files.test.js.map +0 -1
- package/dist/source/ai-gateway/handler.test.d.ts +0 -2
- package/dist/source/ai-gateway/handler.test.d.ts.map +0 -1
- package/dist/source/ai-gateway/handler.test.js +0 -113
- package/dist/source/ai-gateway/handler.test.js.map +0 -1
- package/dist/source/ai-gateway/package.test.d.ts +0 -2
- package/dist/source/ai-gateway/package.test.d.ts.map +0 -1
- package/dist/source/ai-gateway/package.test.js +0 -30
- package/dist/source/ai-gateway/package.test.js.map +0 -1
- package/dist/source/ai-gateway/planner.test.d.ts +0 -2
- package/dist/source/ai-gateway/planner.test.d.ts.map +0 -1
- package/dist/source/ai-gateway/planner.test.js +0 -330
- package/dist/source/ai-gateway/planner.test.js.map +0 -1
- package/dist/source/ai-gateway/release.test.d.ts +0 -2
- package/dist/source/ai-gateway/release.test.d.ts.map +0 -1
- package/dist/source/ai-gateway/release.test.js +0 -62
- package/dist/source/ai-gateway/release.test.js.map +0 -1
- package/dist/test/invoke-test.test.d.ts +0 -2
- package/dist/test/invoke-test.test.d.ts.map +0 -1
- package/dist/test/invoke-test.test.js +0 -150
- package/dist/test/invoke-test.test.js.map +0 -1
- package/dist/test/test-files.test.d.ts +0 -2
- package/dist/test/test-files.test.d.ts.map +0 -1
- package/dist/test/test-files.test.js +0 -57
- package/dist/test/test-files.test.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/file-format.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/file-format.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/file-format.spec.js +0 -289
- package/node_modules/@zuplo/openapi-tools/dist/file-format.spec.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/merge-fixtures.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/merge-fixtures.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/merge-fixtures.spec.js +0 -181
- package/node_modules/@zuplo/openapi-tools/dist/merge-fixtures.spec.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/merge.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/merge.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/merge.spec.js +0 -399
- package/node_modules/@zuplo/openapi-tools/dist/merge.spec.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/overlay.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/overlay.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/overlay.spec.js +0 -779
- package/node_modules/@zuplo/openapi-tools/dist/overlay.spec.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/path-transform.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/path-transform.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/path-transform.spec.js +0 -269
- package/node_modules/@zuplo/openapi-tools/dist/path-transform.spec.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/url-utils.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/url-utils.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/url-utils.spec.js +0 -93
- package/node_modules/@zuplo/openapi-tools/dist/url-utils.spec.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-6YPRGG62.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-PBDT4FDO.js +0 -37
- package/node_modules/@zuplo/runtime/out/esm/chunk-PBDT4FDO.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ2BHVUH.js.map → chunk-CDEAY3VY.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-PBDT4FDO.js.LEGAL.txt → chunk-LVSZ3WTO.js.LEGAL.txt} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-VTO3F6DK.js.map → chunk-NUVXDVLJ.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-6YPRGG62.js.LEGAL.txt → chunk-TPYCFLC7.js.LEGAL.txt} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"linked-config-cascade.integration.test.js","sourceRoot":"","sources":["../../../src/__tests__/integration/linked-config-cascade.integration.test.ts"],"names":[],"mappings":"AAUA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAC5E,OAAO,EAAE,oCAAoC,EAAE,MAAM,wBAA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AM,CAAC,oCAAoC,CAAC,CAAC,oBAAoB,CAC/D,MAAM,CAAC,gBAAgB,CAAC,2BAA2B,CAAC,CACrD,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,aAAa,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Integration tests for the linked-config cascade decline behaviour.\n *\n * When a user is prompted \"Use linked account 'X'?\" and answers No, the\n * useLinkedDetails flag is set to false on argv. Every downstream middleware\n * (fetchProject) must respect that flag and skip their own linked-value prompts —\n * so a manually selected account can never be accidentally paired with a stale\n * linked project.\n */\n/// <reference types=\"jest\" />\nimport nock from \"nock\";\nimport { confirmLinkedConfig } from \"../../common/middleware/confirm-linked-config.js\";\nimport { fetchAccount } from \"../../common/middleware/get-account-param.js\";\nimport { fetchEnvironment } from \"../../common/middleware/get-environment-param.js\";\nimport { fetchProject } from \"../../common/middleware/get-project-param.js\";\nimport { printCriticalFailureToConsoleAndExit } from \"../../common/output.js\";\nimport {\n confirmLinkedValue,\n readLinkedConfig,\n USE_LINKED_DETAILS,\n} from \"../../common/read-linked-config.js\";\nimport { isInteractiveTerminal } from \"../../common/terminal.js\";\nimport {\n cleanupTest,\n setupAuthenticatedNock,\n setupTestEnvironment,\n TEST_ACCOUNT_NAME,\n TEST_API_BASE,\n TEST_AUTH_TOKEN,\n TEST_PROJECT_NAME,\n} from \"./test-utils.js\";\n\njest.mock(\"../../common/read-linked-config.js\", () => ({\n __esModule: true,\n confirmLinkedValue: jest.fn().mockResolvedValue(true),\n readLinkedConfig: jest.fn().mockResolvedValue({}),\n USE_LINKED_DETAILS: \"useLinkedDetails\",\n ignoreLinkedDetails: jest\n .fn()\n .mockImplementation((argv: Record<string, unknown>) => {\n argv[\"useLinkedDetails\"] = false;\n }),\n}));\n\njest.mock(\"../../common/terminal.js\", () => ({\n __esModule: true,\n isInteractiveTerminal: jest.fn().mockReturnValue(true),\n}));\n\ndescribe(\"Linked-config cascade decline\", () => {\n beforeEach(() => {\n setupTestEnvironment();\n nock.disableNetConnect();\n jest.clearAllMocks();\n jest.mocked(isInteractiveTerminal).mockReturnValue(true);\n });\n\n afterEach(() => {\n cleanupTest();\n });\n\n it(\"sets useLinkedDetails to false when user declines linked account\", async () => {\n jest.mocked(readLinkedConfig).mockResolvedValue({\n accountName: TEST_ACCOUNT_NAME,\n });\n // User says No to the linked account prompt\n jest.mocked(confirmLinkedValue).mockResolvedValue(false);\n\n setupAuthenticatedNock(nock(TEST_API_BASE))\n .get(\"/v1/accounts\")\n .reply(200, { data: [{ name: TEST_ACCOUNT_NAME }] });\n\n const argv: Record<string, unknown> = { authToken: TEST_AUTH_TOKEN };\n await fetchAccount(argv);\n\n expect(confirmLinkedValue).toHaveBeenCalledTimes(1);\n expect(argv[USE_LINKED_DETAILS]).toBe(false);\n // account was resolved via the API selection path, not from linked config\n expect(argv.account).toBe(TEST_ACCOUNT_NAME);\n });\n\n it(\"skips linked project prompt when useLinkedDetails is false\", async () => {\n jest.mocked(readLinkedConfig).mockResolvedValue({\n accountName: TEST_ACCOUNT_NAME,\n projectName: TEST_PROJECT_NAME,\n });\n // confirmLinkedValue should never be reached for the project step\n jest\n .mocked(confirmLinkedValue)\n .mockRejectedValue(\n new Error(\"fetchProject must not call confirmLinkedValue after decline\")\n );\n\n setupAuthenticatedNock(nock(TEST_API_BASE))\n .get(\"/v1/projects\")\n .query({ accountName: TEST_ACCOUNT_NAME })\n .reply(200, { data: [{ name: TEST_PROJECT_NAME }] });\n\n const argv: Record<string, unknown> = {\n authToken: TEST_AUTH_TOKEN,\n account: TEST_ACCOUNT_NAME,\n [USE_LINKED_DETAILS]: false,\n };\n await fetchProject(argv);\n\n expect(confirmLinkedValue).not.toHaveBeenCalled();\n expect(argv.project).toBe(TEST_PROJECT_NAME);\n });\n\n it(\"full cascade: declining account prevents linked project prompt\", async () => {\n jest.mocked(readLinkedConfig).mockResolvedValue({\n accountName: TEST_ACCOUNT_NAME,\n projectName: TEST_PROJECT_NAME,\n });\n\n // Only the first call (account) returns false — if project middleware calls\n // confirmLinkedValue, the mock will return false again and it'll fall through\n // to the API. The real test is the call count.\n jest.mocked(confirmLinkedValue).mockResolvedValueOnce(false);\n\n setupAuthenticatedNock(nock(TEST_API_BASE))\n .get(\"/v1/accounts\")\n .reply(200, { data: [{ name: TEST_ACCOUNT_NAME }] });\n\n setupAuthenticatedNock(nock(TEST_API_BASE))\n .get(\"/v1/projects\")\n .query({ accountName: TEST_ACCOUNT_NAME })\n .reply(200, { data: [{ name: TEST_PROJECT_NAME }] });\n\n const argv: Record<string, unknown> = { authToken: TEST_AUTH_TOKEN };\n\n await fetchAccount(argv);\n await fetchProject(argv);\n\n // confirmLinkedValue must only have been called once (for the account prompt).\n // The cascade flag prevented the project prompt.\n expect(confirmLinkedValue).toHaveBeenCalledTimes(1);\n expect(argv[USE_LINKED_DETAILS]).toBe(false);\n });\n\n it(\"uses linked account silently when terminal is non-interactive\", async () => {\n jest.mocked(readLinkedConfig).mockResolvedValue({\n accountName: TEST_ACCOUNT_NAME,\n });\n jest.mocked(isInteractiveTerminal).mockReturnValue(false);\n\n const argv: Record<string, unknown> = { authToken: TEST_AUTH_TOKEN };\n await fetchAccount(argv);\n\n expect(confirmLinkedValue).not.toHaveBeenCalled();\n expect(argv.account).toBe(TEST_ACCOUNT_NAME);\n });\n\n it(\"uses linked project silently when terminal is non-interactive\", async () => {\n jest.mocked(readLinkedConfig).mockResolvedValue({\n accountName: TEST_ACCOUNT_NAME,\n projectName: TEST_PROJECT_NAME,\n });\n jest.mocked(isInteractiveTerminal).mockReturnValue(false);\n\n const argv: Record<string, unknown> = {\n authToken: TEST_AUTH_TOKEN,\n account: TEST_ACCOUNT_NAME,\n };\n await fetchProject(argv);\n\n expect(confirmLinkedValue).not.toHaveBeenCalled();\n expect(argv.project).toBe(TEST_PROJECT_NAME);\n });\n\n it(\"combined prompt accepted: full chain calls confirmLinkedValue exactly once\", async () => {\n jest.mocked(readLinkedConfig).mockResolvedValue({\n accountName: TEST_ACCOUNT_NAME,\n projectName: TEST_PROJECT_NAME,\n });\n jest.mocked(confirmLinkedValue).mockResolvedValue(true);\n\n const argv: Record<string, unknown> = { authToken: TEST_AUTH_TOKEN };\n\n await confirmLinkedConfig(argv);\n await fetchAccount(argv);\n await fetchProject(argv);\n\n expect(confirmLinkedValue).toHaveBeenCalledTimes(1);\n expect(confirmLinkedValue).toHaveBeenCalledWith(\n `Use linked project '${TEST_PROJECT_NAME}' in account '${TEST_ACCOUNT_NAME}'?`\n );\n expect(argv.account).toBe(TEST_ACCOUNT_NAME);\n expect(argv.project).toBe(TEST_PROJECT_NAME);\n });\n\n it(\"combined prompt declined: full chain falls through to API pickers without further linked prompts\", async () => {\n jest.mocked(readLinkedConfig).mockResolvedValue({\n accountName: TEST_ACCOUNT_NAME,\n projectName: TEST_PROJECT_NAME,\n });\n jest.mocked(confirmLinkedValue).mockResolvedValue(false);\n\n setupAuthenticatedNock(nock(TEST_API_BASE))\n .get(\"/v1/accounts\")\n .reply(200, { data: [{ name: TEST_ACCOUNT_NAME }] });\n\n setupAuthenticatedNock(nock(TEST_API_BASE))\n .get(\"/v1/projects\")\n .query({ accountName: TEST_ACCOUNT_NAME })\n .reply(200, { data: [{ name: TEST_PROJECT_NAME }] });\n\n const argv: Record<string, unknown> = { authToken: TEST_AUTH_TOKEN };\n\n await confirmLinkedConfig(argv);\n await fetchAccount(argv);\n await fetchProject(argv);\n\n // The combined prompt fired once. Downstream middlewares must not re-prompt\n // because USE_LINKED_DETAILS was set to false on decline.\n expect(confirmLinkedValue).toHaveBeenCalledTimes(1);\n expect(argv[USE_LINKED_DETAILS]).toBe(false);\n });\n\n it(\"fails loudly when --project is omitted in non-interactive environments without linked config\", async () => {\n jest.mocked(readLinkedConfig).mockResolvedValue({});\n jest.mocked(isInteractiveTerminal).mockReturnValue(false);\n\n const argv: Record<string, unknown> = {\n authToken: TEST_AUTH_TOKEN,\n account: TEST_ACCOUNT_NAME,\n };\n\n // The guard fires before any API call, so no nock interceptor is needed.\n await expect(fetchProject(argv)).rejects.toThrow(\"Process would exit\");\n\n expect(printCriticalFailureToConsoleAndExit).toHaveBeenCalledWith(\n expect.stringContaining(\"--project is required\")\n );\n expect(argv.project).toBeUndefined();\n });\n\n it(\"fails loudly when --account is omitted in non-interactive environments without linked config\", async () => {\n jest.mocked(readLinkedConfig).mockResolvedValue({});\n jest.mocked(isInteractiveTerminal).mockReturnValue(false);\n\n const argv: Record<string, unknown> = { authToken: TEST_AUTH_TOKEN };\n\n // The guard fires before any API call, so no nock interceptor is needed.\n await expect(fetchAccount(argv)).rejects.toThrow(\"Process would exit\");\n\n expect(printCriticalFailureToConsoleAndExit).toHaveBeenCalledWith(\n expect.stringContaining(\"--account is required\")\n );\n expect(argv.account).toBeUndefined();\n });\n\n it(\"fails loudly when --environment is omitted in non-interactive environments\", async () => {\n jest.mocked(isInteractiveTerminal).mockReturnValue(false);\n\n // No argv.dir means getGitBranch returns undefined, falling through to the\n // non-interactive guard before any API call is made.\n const argv: Record<string, unknown> = {\n authToken: TEST_AUTH_TOKEN,\n account: TEST_ACCOUNT_NAME,\n project: TEST_PROJECT_NAME,\n };\n\n await expect(fetchEnvironment(argv)).rejects.toThrow(\"Process would exit\");\n\n expect(printCriticalFailureToConsoleAndExit).toHaveBeenCalledWith(\n expect.stringContaining(\"--environment is required\")\n );\n expect(argv.environment).toBeUndefined();\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list.integration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/list.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
import nock from "nock";
|
|
2
|
-
import yargs from "yargs/yargs";
|
|
3
|
-
import listCommand from "../../cmds/list.js";
|
|
4
|
-
import { cleanupTest, RequestCapture, setupAuthenticatedNock, setupTestEnvironment, TEST_ACCOUNT_NAME, TEST_API_BASE, TEST_AUTH_TOKEN, TEST_PROJECT_NAME, } from "./test-utils.js";
|
|
5
|
-
async function executeListCommand(args) {
|
|
6
|
-
const yargsInstance = yargs([])
|
|
7
|
-
.command(listCommand)
|
|
8
|
-
.help(false)
|
|
9
|
-
.version(false)
|
|
10
|
-
.exitProcess(false);
|
|
11
|
-
const commandArgs = ["list"];
|
|
12
|
-
if (args.account) {
|
|
13
|
-
commandArgs.push("--account", args.account);
|
|
14
|
-
}
|
|
15
|
-
if (args.project) {
|
|
16
|
-
commandArgs.push("--project", args.project);
|
|
17
|
-
}
|
|
18
|
-
if (args["api-key"]) {
|
|
19
|
-
commandArgs.push("--api-key", args["api-key"]);
|
|
20
|
-
}
|
|
21
|
-
if (args["show-details"]) {
|
|
22
|
-
commandArgs.push("--show-details");
|
|
23
|
-
}
|
|
24
|
-
if (args.output) {
|
|
25
|
-
commandArgs.push("--output", args.output);
|
|
26
|
-
}
|
|
27
|
-
if (args["self-hosted-endpoint"]) {
|
|
28
|
-
commandArgs.push("--self-hosted-endpoint", args["self-hosted-endpoint"]);
|
|
29
|
-
}
|
|
30
|
-
return await yargsInstance.parse(commandArgs);
|
|
31
|
-
}
|
|
32
|
-
const mockPrintResult = jest.mocked(require("../../common/output.js").printResultToConsoleAndExitGracefully);
|
|
33
|
-
const mockPrintTable = jest.mocked(require("../../common/output.js").printTableToConsoleAndExitGracefully);
|
|
34
|
-
const mockPrintJson = jest.mocked(require("../../common/output.js").printJsonToConsoleAndExitGracefully);
|
|
35
|
-
const mockPrintDiagnostics = jest.mocked(require("../../common/output.js").printDiagnosticsToConsole);
|
|
36
|
-
describe("List Command Integration Tests", () => {
|
|
37
|
-
let requestCapture;
|
|
38
|
-
beforeEach(() => {
|
|
39
|
-
setupTestEnvironment();
|
|
40
|
-
requestCapture = new RequestCapture();
|
|
41
|
-
nock.disableNetConnect();
|
|
42
|
-
jest.clearAllMocks();
|
|
43
|
-
});
|
|
44
|
-
afterEach(() => {
|
|
45
|
-
cleanupTest();
|
|
46
|
-
requestCapture.clear();
|
|
47
|
-
});
|
|
48
|
-
describe("SaaS version", () => {
|
|
49
|
-
it("should intercept GET request to list deployments with account and project", async () => {
|
|
50
|
-
const mockResponse = {
|
|
51
|
-
data: [
|
|
52
|
-
{ url: "https://test-project-production.zuplo.app" },
|
|
53
|
-
{ url: "https://test-project-staging.zuplo.app" },
|
|
54
|
-
],
|
|
55
|
-
};
|
|
56
|
-
const scope = setupAuthenticatedNock(nock(TEST_API_BASE))
|
|
57
|
-
.get(`/v1/accounts/${TEST_ACCOUNT_NAME}/projects/${TEST_PROJECT_NAME}/deployments`)
|
|
58
|
-
.reply(200, mockResponse);
|
|
59
|
-
scope.on("request", (req, interceptor, body) => {
|
|
60
|
-
requestCapture.capture(req, interceptor, body);
|
|
61
|
-
});
|
|
62
|
-
await executeListCommand({
|
|
63
|
-
account: TEST_ACCOUNT_NAME,
|
|
64
|
-
project: TEST_PROJECT_NAME,
|
|
65
|
-
"api-key": TEST_AUTH_TOKEN,
|
|
66
|
-
});
|
|
67
|
-
expect(scope.isDone()).toBe(true);
|
|
68
|
-
const expectedOutput = "https://test-project-production.zuplo.app\nhttps://test-project-staging.zuplo.app";
|
|
69
|
-
expect(mockPrintResult).toHaveBeenCalledWith(expectedOutput);
|
|
70
|
-
const capturedRequests = requestCapture.getRequests();
|
|
71
|
-
expect(capturedRequests).toMatchSnapshot("list-deployments-saas-requests");
|
|
72
|
-
});
|
|
73
|
-
it("should handle empty deployments list", async () => {
|
|
74
|
-
const mockResponse = { data: [] };
|
|
75
|
-
const scope = setupAuthenticatedNock(nock(TEST_API_BASE))
|
|
76
|
-
.get(`/v1/accounts/${TEST_ACCOUNT_NAME}/projects/${TEST_PROJECT_NAME}/deployments`)
|
|
77
|
-
.reply(200, mockResponse);
|
|
78
|
-
scope.on("request", (req, interceptor, body) => {
|
|
79
|
-
requestCapture.capture(req, interceptor, body);
|
|
80
|
-
});
|
|
81
|
-
await executeListCommand({
|
|
82
|
-
account: TEST_ACCOUNT_NAME,
|
|
83
|
-
project: TEST_PROJECT_NAME,
|
|
84
|
-
"api-key": TEST_AUTH_TOKEN,
|
|
85
|
-
});
|
|
86
|
-
expect(scope.isDone()).toBe(true);
|
|
87
|
-
expect(mockPrintResult).toHaveBeenCalledWith("");
|
|
88
|
-
const capturedRequests = requestCapture.getRequests();
|
|
89
|
-
expect(capturedRequests).toMatchSnapshot("list-deployments-empty-requests");
|
|
90
|
-
});
|
|
91
|
-
it("should output deployment details as a table when requested", async () => {
|
|
92
|
-
const mockResponse = {
|
|
93
|
-
data: [
|
|
94
|
-
{
|
|
95
|
-
projectName: TEST_PROJECT_NAME,
|
|
96
|
-
name: "test-project-main-3c1ac0c",
|
|
97
|
-
url: "https://test-project-main-3c1ac0c.zuplo.app",
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
projectName: TEST_PROJECT_NAME,
|
|
101
|
-
name: "test-project-main-47839f2",
|
|
102
|
-
url: "https://test-project-main-47839f2.d2.zuplo.dev",
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
};
|
|
106
|
-
const scope = setupAuthenticatedNock(nock(TEST_API_BASE))
|
|
107
|
-
.get(`/v1/accounts/${TEST_ACCOUNT_NAME}/projects/${TEST_PROJECT_NAME}/deployments`)
|
|
108
|
-
.reply(200, mockResponse);
|
|
109
|
-
await executeListCommand({
|
|
110
|
-
account: TEST_ACCOUNT_NAME,
|
|
111
|
-
project: TEST_PROJECT_NAME,
|
|
112
|
-
"api-key": TEST_AUTH_TOKEN,
|
|
113
|
-
"show-details": true,
|
|
114
|
-
});
|
|
115
|
-
expect(scope.isDone()).toBe(true);
|
|
116
|
-
expect(mockPrintTable).toHaveBeenCalledWith([
|
|
117
|
-
{
|
|
118
|
-
"project-name": TEST_PROJECT_NAME,
|
|
119
|
-
name: "test-project-main-3c1ac0c",
|
|
120
|
-
url: "https://test-project-main-3c1ac0c.zuplo.app",
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
"project-name": TEST_PROJECT_NAME,
|
|
124
|
-
name: "test-project-main-47839f2",
|
|
125
|
-
url: "https://test-project-main-47839f2.d2.zuplo.dev",
|
|
126
|
-
},
|
|
127
|
-
]);
|
|
128
|
-
});
|
|
129
|
-
it("should support the -d alias for details output", async () => {
|
|
130
|
-
const mockResponse = {
|
|
131
|
-
data: [
|
|
132
|
-
{
|
|
133
|
-
projectName: TEST_PROJECT_NAME,
|
|
134
|
-
name: "test-project-main-3c1ac0c",
|
|
135
|
-
url: "https://test-project-main-3c1ac0c.zuplo.app",
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
};
|
|
139
|
-
const scope = setupAuthenticatedNock(nock(TEST_API_BASE))
|
|
140
|
-
.get(`/v1/accounts/${TEST_ACCOUNT_NAME}/projects/${TEST_PROJECT_NAME}/deployments`)
|
|
141
|
-
.reply(200, mockResponse);
|
|
142
|
-
const yargsInstance = yargs([])
|
|
143
|
-
.command(listCommand)
|
|
144
|
-
.help(false)
|
|
145
|
-
.version(false)
|
|
146
|
-
.exitProcess(false);
|
|
147
|
-
await yargsInstance.parse([
|
|
148
|
-
"list",
|
|
149
|
-
"--account",
|
|
150
|
-
TEST_ACCOUNT_NAME,
|
|
151
|
-
"--project",
|
|
152
|
-
TEST_PROJECT_NAME,
|
|
153
|
-
"--api-key",
|
|
154
|
-
TEST_AUTH_TOKEN,
|
|
155
|
-
"-d",
|
|
156
|
-
]);
|
|
157
|
-
expect(scope.isDone()).toBe(true);
|
|
158
|
-
expect(mockPrintTable).toHaveBeenCalledWith([
|
|
159
|
-
{
|
|
160
|
-
"project-name": TEST_PROJECT_NAME,
|
|
161
|
-
name: "test-project-main-3c1ac0c",
|
|
162
|
-
url: "https://test-project-main-3c1ac0c.zuplo.app",
|
|
163
|
-
},
|
|
164
|
-
]);
|
|
165
|
-
});
|
|
166
|
-
it("should output JSON when requested", async () => {
|
|
167
|
-
const mockResponse = {
|
|
168
|
-
data: [
|
|
169
|
-
{
|
|
170
|
-
projectName: TEST_PROJECT_NAME,
|
|
171
|
-
name: "test-project-main-3c1ac0c",
|
|
172
|
-
url: "https://test-project-main-3c1ac0c.zuplo.app",
|
|
173
|
-
},
|
|
174
|
-
],
|
|
175
|
-
};
|
|
176
|
-
const scope = setupAuthenticatedNock(nock(TEST_API_BASE))
|
|
177
|
-
.get(`/v1/accounts/${TEST_ACCOUNT_NAME}/projects/${TEST_PROJECT_NAME}/deployments`)
|
|
178
|
-
.reply(200, mockResponse);
|
|
179
|
-
await executeListCommand({
|
|
180
|
-
account: TEST_ACCOUNT_NAME,
|
|
181
|
-
project: TEST_PROJECT_NAME,
|
|
182
|
-
"api-key": TEST_AUTH_TOKEN,
|
|
183
|
-
output: "json",
|
|
184
|
-
});
|
|
185
|
-
expect(scope.isDone()).toBe(true);
|
|
186
|
-
expect(mockPrintJson).toHaveBeenCalledWith([
|
|
187
|
-
"https://test-project-main-3c1ac0c.zuplo.app",
|
|
188
|
-
]);
|
|
189
|
-
});
|
|
190
|
-
it("should output detailed JSON when requested", async () => {
|
|
191
|
-
const mockResponse = {
|
|
192
|
-
data: [
|
|
193
|
-
{
|
|
194
|
-
projectName: TEST_PROJECT_NAME,
|
|
195
|
-
name: "test-project-main-3c1ac0c",
|
|
196
|
-
url: "https://test-project-main-3c1ac0c.zuplo.app",
|
|
197
|
-
},
|
|
198
|
-
],
|
|
199
|
-
};
|
|
200
|
-
const scope = setupAuthenticatedNock(nock(TEST_API_BASE))
|
|
201
|
-
.get(`/v1/accounts/${TEST_ACCOUNT_NAME}/projects/${TEST_PROJECT_NAME}/deployments`)
|
|
202
|
-
.reply(200, mockResponse);
|
|
203
|
-
await executeListCommand({
|
|
204
|
-
account: TEST_ACCOUNT_NAME,
|
|
205
|
-
project: TEST_PROJECT_NAME,
|
|
206
|
-
"api-key": TEST_AUTH_TOKEN,
|
|
207
|
-
"show-details": true,
|
|
208
|
-
output: "json",
|
|
209
|
-
});
|
|
210
|
-
expect(scope.isDone()).toBe(true);
|
|
211
|
-
expect(mockPrintJson).toHaveBeenCalledWith([
|
|
212
|
-
{
|
|
213
|
-
projectName: TEST_PROJECT_NAME,
|
|
214
|
-
name: "test-project-main-3c1ac0c",
|
|
215
|
-
url: "https://test-project-main-3c1ac0c.zuplo.app",
|
|
216
|
-
},
|
|
217
|
-
]);
|
|
218
|
-
});
|
|
219
|
-
it("should handle API error responses", async () => {
|
|
220
|
-
const errorResponse = {
|
|
221
|
-
error: "Not Found",
|
|
222
|
-
message: "Project not found",
|
|
223
|
-
statusCode: 404,
|
|
224
|
-
};
|
|
225
|
-
const scope = setupAuthenticatedNock(nock(TEST_API_BASE))
|
|
226
|
-
.get(`/v1/accounts/${TEST_ACCOUNT_NAME}/projects/${TEST_PROJECT_NAME}/deployments`)
|
|
227
|
-
.reply(404, errorResponse);
|
|
228
|
-
scope.on("request", (req, interceptor, body) => {
|
|
229
|
-
requestCapture.capture(req, interceptor, body);
|
|
230
|
-
});
|
|
231
|
-
await expect(executeListCommand({
|
|
232
|
-
account: TEST_ACCOUNT_NAME,
|
|
233
|
-
project: TEST_PROJECT_NAME,
|
|
234
|
-
"api-key": TEST_AUTH_TOKEN,
|
|
235
|
-
})).rejects.toThrow("Failed to list deployed APIs");
|
|
236
|
-
expect(scope.isDone()).toBe(true);
|
|
237
|
-
expect(mockPrintDiagnostics).toHaveBeenCalled();
|
|
238
|
-
const capturedRequests = requestCapture.getRequests();
|
|
239
|
-
expect(capturedRequests).toMatchSnapshot("list-deployments-error-requests");
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
describe("Self-hosted version", () => {
|
|
243
|
-
it("should intercept GET request to self-hosted endpoint", async () => {
|
|
244
|
-
const selfHostedEndpoint = "https://my-zuplo.company.com";
|
|
245
|
-
const mockResponse = {
|
|
246
|
-
data: [
|
|
247
|
-
{
|
|
248
|
-
projectName: "project-1",
|
|
249
|
-
deploymentName: "deployment-1",
|
|
250
|
-
deploymentUrl: "https://my-zuplo.company.com/project1",
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
projectName: "project-2",
|
|
254
|
-
deploymentName: "deployment-2",
|
|
255
|
-
deploymentUrl: "https://my-zuplo.company.com/project2",
|
|
256
|
-
},
|
|
257
|
-
],
|
|
258
|
-
};
|
|
259
|
-
const scope = setupAuthenticatedNock(nock(selfHostedEndpoint))
|
|
260
|
-
.get("/v1/deployments")
|
|
261
|
-
.reply(200, mockResponse);
|
|
262
|
-
scope.on("request", (req, interceptor, body) => {
|
|
263
|
-
requestCapture.capture(req, interceptor, body);
|
|
264
|
-
});
|
|
265
|
-
await executeListCommand({
|
|
266
|
-
account: TEST_ACCOUNT_NAME,
|
|
267
|
-
project: TEST_PROJECT_NAME,
|
|
268
|
-
"api-key": TEST_AUTH_TOKEN,
|
|
269
|
-
"self-hosted-endpoint": selfHostedEndpoint,
|
|
270
|
-
});
|
|
271
|
-
expect(scope.isDone()).toBe(true);
|
|
272
|
-
const expectedOutput = "https://my-zuplo.company.com/project1\nhttps://my-zuplo.company.com/project2";
|
|
273
|
-
expect(mockPrintResult).toHaveBeenCalledWith(expectedOutput);
|
|
274
|
-
const capturedRequests = requestCapture.getRequests();
|
|
275
|
-
expect(capturedRequests).toMatchSnapshot("list-deployments-self-hosted-requests");
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
describe("Request headers validation", () => {
|
|
279
|
-
it("should include correct authorization headers", async () => {
|
|
280
|
-
const mockResponse = { data: [{ url: "https://test.zuplo.app" }] };
|
|
281
|
-
const scope = nock(TEST_API_BASE)
|
|
282
|
-
.get(`/v1/accounts/${TEST_ACCOUNT_NAME}/projects/${TEST_PROJECT_NAME}/deployments`)
|
|
283
|
-
.matchHeader("authorization", `Bearer ${TEST_AUTH_TOKEN}`)
|
|
284
|
-
.reply(200, mockResponse);
|
|
285
|
-
scope.on("request", (req, interceptor, body) => {
|
|
286
|
-
requestCapture.capture(req, interceptor, body);
|
|
287
|
-
});
|
|
288
|
-
await executeListCommand({
|
|
289
|
-
account: TEST_ACCOUNT_NAME,
|
|
290
|
-
project: TEST_PROJECT_NAME,
|
|
291
|
-
"api-key": TEST_AUTH_TOKEN,
|
|
292
|
-
});
|
|
293
|
-
expect(scope.isDone()).toBe(true);
|
|
294
|
-
expect(mockPrintResult).toHaveBeenCalledWith("https://test.zuplo.app");
|
|
295
|
-
const capturedRequests = requestCapture.getRequests();
|
|
296
|
-
expect(capturedRequests).toMatchSnapshot("list-deployments-headers-validation");
|
|
297
|
-
});
|
|
298
|
-
});
|
|
299
|
-
});
|
|
300
|
-
//# sourceMappingURL=list.integration.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list.integration.test.js","sourceRoot":"","sources":["../../../src/__tests__/integration/list.integration.test.ts"],"names":[],"mappings":"AAIA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EACL,WAAW,EACX,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAKzB,KAAK,UAAU,kBAAkB,CAAC,IAOjC;IACC,MAAM,aAAa,GAAG,KAAK,CAAC,EAAE,CAAC;SAC5B,OAAO,CAAC,WAAW,CAAC;SACpB,IAAI,CAAC,KAAK,CAAC;SACX,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,KAAK,CAAC,CAAC;IAGtB,MAAM,WAAW,GAAG,CAAC,MAAM,CAAC,CAAC;IAE7B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,I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BAAkB,CAAC;gBACvB,OAAO,EAAE,iBAAiB;gBAC1B,OAAO,EAAE,iBAAiB;gBAC1B,SAAS,EAAE,eAAe;aAC3B,CAAC,CAAC;YAEH,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClC,MAAM,CAAC,eAAe,CAAC,CAAC,oBAAoB,CAAC,wBAAwB,CAAC,CAAC;YAEvE,MAAM,gBAAgB,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;YACtD,MAAM,CAAC,gBAAgB,CAAC,CAAC,eAAe,CACtC,qCAAqC,CACtC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Integration tests for the list command\n */\n/// <reference types=\"jest\" />\nimport nock from \"nock\";\nimport yargs from \"yargs/yargs\";\nimport listCommand from \"../../cmds/list.js\";\nimport {\n cleanupTest,\n RequestCapture,\n setupAuthenticatedNock,\n setupTestEnvironment,\n TEST_ACCOUNT_NAME,\n TEST_API_BASE,\n TEST_AUTH_TOKEN,\n TEST_PROJECT_NAME,\n} from \"./test-utils.js\";\n\n/**\n * Execute list command with given arguments using actual yargs command\n */\nasync function executeListCommand(args: {\n account?: string;\n project?: string;\n \"api-key\"?: string;\n \"show-details\"?: boolean;\n output?: \"default\" | \"json\";\n \"self-hosted-endpoint\"?: string;\n}) {\n const yargsInstance = yargs([])\n .command(listCommand)\n .help(false)\n .version(false)\n .exitProcess(false);\n\n // Build command line arguments\n const commandArgs = [\"list\"];\n\n if (args.account) {\n commandArgs.push(\"--account\", args.account);\n }\n\n if (args.project) {\n commandArgs.push(\"--project\", args.project);\n }\n\n if (args[\"api-key\"]) {\n commandArgs.push(\"--api-key\", args[\"api-key\"]);\n }\n\n if (args[\"show-details\"]) {\n commandArgs.push(\"--show-details\");\n }\n\n if (args.output) {\n commandArgs.push(\"--output\", args.output);\n }\n\n if (args[\"self-hosted-endpoint\"]) {\n commandArgs.push(\"--self-hosted-endpoint\", args[\"self-hosted-endpoint\"]);\n }\n\n // Parse and execute the command\n return await yargsInstance.parse(commandArgs);\n}\n\n// Get the mocked functions\nconst mockPrintResult = jest.mocked(\n require(\"../../common/output.js\").printResultToConsoleAndExitGracefully\n);\nconst mockPrintTable = jest.mocked(\n require(\"../../common/output.js\").printTableToConsoleAndExitGracefully\n);\nconst mockPrintJson = jest.mocked(\n require(\"../../common/output.js\").printJsonToConsoleAndExitGracefully\n);\nconst mockPrintDiagnostics = jest.mocked(\n require(\"../../common/output.js\").printDiagnosticsToConsole\n);\n\ndescribe(\"List Command Integration Tests\", () => {\n let requestCapture: RequestCapture;\n\n beforeEach(() => {\n setupTestEnvironment();\n requestCapture = new RequestCapture();\n\n // Disable real HTTP requests\n nock.disableNetConnect();\n\n // Clear mock calls from previous tests\n jest.clearAllMocks();\n });\n\n afterEach(() => {\n cleanupTest();\n requestCapture.clear();\n });\n\n describe(\"SaaS version\", () => {\n it(\"should intercept GET request to list deployments with account and project\", async () => {\n const mockResponse = {\n data: [\n { url: \"https://test-project-production.zuplo.app\" },\n { url: \"https://test-project-staging.zuplo.app\" },\n ],\n };\n\n const scope = setupAuthenticatedNock(nock(TEST_API_BASE))\n .get(\n `/v1/accounts/${TEST_ACCOUNT_NAME}/projects/${TEST_PROJECT_NAME}/deployments`\n )\n .reply(200, mockResponse);\n\n // Capture requests for snapshot testing\n scope.on(\"request\", (req, interceptor, body) => {\n requestCapture.capture(req, interceptor, body);\n });\n\n // Execute the list command through yargs\n await executeListCommand({\n account: TEST_ACCOUNT_NAME,\n project: TEST_PROJECT_NAME,\n \"api-key\": TEST_AUTH_TOKEN,\n });\n\n // Verify the request was made\n expect(scope.isDone()).toBe(true);\n\n // Verify the output function was called with the URLs\n const expectedOutput =\n \"https://test-project-production.zuplo.app\\nhttps://test-project-staging.zuplo.app\";\n expect(mockPrintResult).toHaveBeenCalledWith(expectedOutput);\n\n // Snapshot test for captured requests\n const capturedRequests = requestCapture.getRequests();\n expect(capturedRequests).toMatchSnapshot(\n \"list-deployments-saas-requests\"\n );\n });\n\n it(\"should handle empty deployments list\", async () => {\n const mockResponse = { data: [] };\n\n const scope = setupAuthenticatedNock(nock(TEST_API_BASE))\n .get(\n `/v1/accounts/${TEST_ACCOUNT_NAME}/projects/${TEST_PROJECT_NAME}/deployments`\n )\n .reply(200, mockResponse);\n\n scope.on(\"request\", (req, interceptor, body) => {\n requestCapture.capture(req, interceptor, body);\n });\n\n await executeListCommand({\n account: TEST_ACCOUNT_NAME,\n project: TEST_PROJECT_NAME,\n \"api-key\": TEST_AUTH_TOKEN,\n });\n\n expect(scope.isDone()).toBe(true);\n expect(mockPrintResult).toHaveBeenCalledWith(\"\");\n\n const capturedRequests = requestCapture.getRequests();\n expect(capturedRequests).toMatchSnapshot(\n \"list-deployments-empty-requests\"\n );\n });\n\n it(\"should output deployment details as a table when requested\", async () => {\n const mockResponse = {\n data: [\n {\n projectName: TEST_PROJECT_NAME,\n name: \"test-project-main-3c1ac0c\",\n url: \"https://test-project-main-3c1ac0c.zuplo.app\",\n },\n {\n projectName: TEST_PROJECT_NAME,\n name: \"test-project-main-47839f2\",\n url: \"https://test-project-main-47839f2.d2.zuplo.dev\",\n },\n ],\n };\n\n const scope = setupAuthenticatedNock(nock(TEST_API_BASE))\n .get(\n `/v1/accounts/${TEST_ACCOUNT_NAME}/projects/${TEST_PROJECT_NAME}/deployments`\n )\n .reply(200, mockResponse);\n\n await executeListCommand({\n account: TEST_ACCOUNT_NAME,\n project: TEST_PROJECT_NAME,\n \"api-key\": TEST_AUTH_TOKEN,\n \"show-details\": true,\n });\n\n expect(scope.isDone()).toBe(true);\n expect(mockPrintTable).toHaveBeenCalledWith([\n {\n \"project-name\": TEST_PROJECT_NAME,\n name: \"test-project-main-3c1ac0c\",\n url: \"https://test-project-main-3c1ac0c.zuplo.app\",\n },\n {\n \"project-name\": TEST_PROJECT_NAME,\n name: \"test-project-main-47839f2\",\n url: \"https://test-project-main-47839f2.d2.zuplo.dev\",\n },\n ]);\n });\n\n it(\"should support the -d alias for details output\", async () => {\n const mockResponse = {\n data: [\n {\n projectName: TEST_PROJECT_NAME,\n name: \"test-project-main-3c1ac0c\",\n url: \"https://test-project-main-3c1ac0c.zuplo.app\",\n },\n ],\n };\n\n const scope = setupAuthenticatedNock(nock(TEST_API_BASE))\n .get(\n `/v1/accounts/${TEST_ACCOUNT_NAME}/projects/${TEST_PROJECT_NAME}/deployments`\n )\n .reply(200, mockResponse);\n\n const yargsInstance = yargs([])\n .command(listCommand)\n .help(false)\n .version(false)\n .exitProcess(false);\n\n await yargsInstance.parse([\n \"list\",\n \"--account\",\n TEST_ACCOUNT_NAME,\n \"--project\",\n TEST_PROJECT_NAME,\n \"--api-key\",\n TEST_AUTH_TOKEN,\n \"-d\",\n ]);\n\n expect(scope.isDone()).toBe(true);\n expect(mockPrintTable).toHaveBeenCalledWith([\n {\n \"project-name\": TEST_PROJECT_NAME,\n name: \"test-project-main-3c1ac0c\",\n url: \"https://test-project-main-3c1ac0c.zuplo.app\",\n },\n ]);\n });\n\n it(\"should output JSON when requested\", async () => {\n const mockResponse = {\n data: [\n {\n projectName: TEST_PROJECT_NAME,\n name: \"test-project-main-3c1ac0c\",\n url: \"https://test-project-main-3c1ac0c.zuplo.app\",\n },\n ],\n };\n\n const scope = setupAuthenticatedNock(nock(TEST_API_BASE))\n .get(\n `/v1/accounts/${TEST_ACCOUNT_NAME}/projects/${TEST_PROJECT_NAME}/deployments`\n )\n .reply(200, mockResponse);\n\n await executeListCommand({\n account: TEST_ACCOUNT_NAME,\n project: TEST_PROJECT_NAME,\n \"api-key\": TEST_AUTH_TOKEN,\n output: \"json\",\n });\n\n expect(scope.isDone()).toBe(true);\n expect(mockPrintJson).toHaveBeenCalledWith([\n \"https://test-project-main-3c1ac0c.zuplo.app\",\n ]);\n });\n\n it(\"should output detailed JSON when requested\", async () => {\n const mockResponse = {\n data: [\n {\n projectName: TEST_PROJECT_NAME,\n name: \"test-project-main-3c1ac0c\",\n url: \"https://test-project-main-3c1ac0c.zuplo.app\",\n },\n ],\n };\n\n const scope = setupAuthenticatedNock(nock(TEST_API_BASE))\n .get(\n `/v1/accounts/${TEST_ACCOUNT_NAME}/projects/${TEST_PROJECT_NAME}/deployments`\n )\n .reply(200, mockResponse);\n\n await executeListCommand({\n account: TEST_ACCOUNT_NAME,\n project: TEST_PROJECT_NAME,\n \"api-key\": TEST_AUTH_TOKEN,\n \"show-details\": true,\n output: \"json\",\n });\n\n expect(scope.isDone()).toBe(true);\n expect(mockPrintJson).toHaveBeenCalledWith([\n {\n projectName: TEST_PROJECT_NAME,\n name: \"test-project-main-3c1ac0c\",\n url: \"https://test-project-main-3c1ac0c.zuplo.app\",\n },\n ]);\n });\n\n it(\"should handle API error responses\", async () => {\n const errorResponse = {\n error: \"Not Found\",\n message: \"Project not found\",\n statusCode: 404,\n };\n\n const scope = setupAuthenticatedNock(nock(TEST_API_BASE))\n .get(\n `/v1/accounts/${TEST_ACCOUNT_NAME}/projects/${TEST_PROJECT_NAME}/deployments`\n )\n .reply(404, errorResponse);\n\n scope.on(\"request\", (req, interceptor, body) => {\n requestCapture.capture(req, interceptor, body);\n });\n\n await expect(\n executeListCommand({\n account: TEST_ACCOUNT_NAME,\n project: TEST_PROJECT_NAME,\n \"api-key\": TEST_AUTH_TOKEN,\n })\n ).rejects.toThrow(\"Failed to list deployed APIs\");\n\n expect(scope.isDone()).toBe(true);\n expect(mockPrintDiagnostics).toHaveBeenCalled();\n\n const capturedRequests = requestCapture.getRequests();\n expect(capturedRequests).toMatchSnapshot(\n \"list-deployments-error-requests\"\n );\n });\n });\n\n describe(\"Self-hosted version\", () => {\n it(\"should intercept GET request to self-hosted endpoint\", async () => {\n const selfHostedEndpoint = \"https://my-zuplo.company.com\";\n const mockResponse = {\n data: [\n {\n projectName: \"project-1\",\n deploymentName: \"deployment-1\",\n deploymentUrl: \"https://my-zuplo.company.com/project1\",\n },\n {\n projectName: \"project-2\",\n deploymentName: \"deployment-2\",\n deploymentUrl: \"https://my-zuplo.company.com/project2\",\n },\n ],\n };\n\n const scope = setupAuthenticatedNock(nock(selfHostedEndpoint))\n .get(\"/v1/deployments\")\n .reply(200, mockResponse);\n\n scope.on(\"request\", (req, interceptor, body) => {\n requestCapture.capture(req, interceptor, body);\n });\n\n await executeListCommand({\n account: TEST_ACCOUNT_NAME,\n project: TEST_PROJECT_NAME,\n \"api-key\": TEST_AUTH_TOKEN,\n \"self-hosted-endpoint\": selfHostedEndpoint,\n });\n\n expect(scope.isDone()).toBe(true);\n const expectedOutput =\n \"https://my-zuplo.company.com/project1\\nhttps://my-zuplo.company.com/project2\";\n expect(mockPrintResult).toHaveBeenCalledWith(expectedOutput);\n\n const capturedRequests = requestCapture.getRequests();\n expect(capturedRequests).toMatchSnapshot(\n \"list-deployments-self-hosted-requests\"\n );\n });\n });\n\n describe(\"Request headers validation\", () => {\n it(\"should include correct authorization headers\", async () => {\n const mockResponse = { data: [{ url: \"https://test.zuplo.app\" }] };\n\n const scope = nock(TEST_API_BASE)\n .get(\n `/v1/accounts/${TEST_ACCOUNT_NAME}/projects/${TEST_PROJECT_NAME}/deployments`\n )\n .matchHeader(\"authorization\", `Bearer ${TEST_AUTH_TOKEN}`)\n .reply(200, mockResponse);\n\n scope.on(\"request\", (req, interceptor, body) => {\n requestCapture.capture(req, interceptor, body);\n });\n\n await executeListCommand({\n account: TEST_ACCOUNT_NAME,\n project: TEST_PROJECT_NAME,\n \"api-key\": TEST_AUTH_TOKEN,\n });\n\n expect(scope.isDone()).toBe(true);\n expect(mockPrintResult).toHaveBeenCalledWith(\"https://test.zuplo.app\");\n\n const capturedRequests = requestCapture.getRequests();\n expect(capturedRequests).toMatchSnapshot(\n \"list-deployments-headers-validation\"\n );\n });\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"source-upgrade.integration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/source-upgrade.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import yargs from "yargs/yargs";
|
|
2
|
-
import upgrade from "../../cmds/source/upgrade.js";
|
|
3
|
-
import { shutdownAnalytics } from "../../common/analytics/lib.js";
|
|
4
|
-
import { upgradeGateway } from "../../source/ai-gateway/handler.js";
|
|
5
|
-
import { update } from "../../source/update/handler.js";
|
|
6
|
-
jest.mock("../../source/update/handler.js", () => ({
|
|
7
|
-
update: jest.fn().mockResolvedValue(undefined),
|
|
8
|
-
}));
|
|
9
|
-
jest.mock("../../source/ai-gateway/handler.js", () => ({
|
|
10
|
-
upgradeGateway: jest.fn().mockResolvedValue(0),
|
|
11
|
-
}));
|
|
12
|
-
jest.mock("../../common/analytics/lib.js", () => ({
|
|
13
|
-
captureEvent: jest.fn().mockResolvedValue(undefined),
|
|
14
|
-
shutdownAnalytics: jest.fn().mockResolvedValue(undefined),
|
|
15
|
-
}));
|
|
16
|
-
jest.mock("../../common/middleware/user-identification.js", () => ({
|
|
17
|
-
identify: jest.fn(),
|
|
18
|
-
}));
|
|
19
|
-
jest.mock("../../common/validators/file-system-validator.js", () => ({
|
|
20
|
-
ZuploProjectValidator: jest.fn().mockImplementation(() => ({
|
|
21
|
-
validate: jest.fn().mockResolvedValue({ ok: true }),
|
|
22
|
-
})),
|
|
23
|
-
}));
|
|
24
|
-
const originalArgv = process.argv;
|
|
25
|
-
const originalEnv = { ...process.env };
|
|
26
|
-
afterEach(() => {
|
|
27
|
-
process.argv = originalArgv;
|
|
28
|
-
for (const key of Object.keys(process.env))
|
|
29
|
-
if (!(key in originalEnv))
|
|
30
|
-
delete process.env[key];
|
|
31
|
-
Object.assign(process.env, originalEnv);
|
|
32
|
-
jest.clearAllMocks();
|
|
33
|
-
});
|
|
34
|
-
async function run(args) {
|
|
35
|
-
process.argv = ["node", "zuplo", "source", ...args];
|
|
36
|
-
return yargs(args)
|
|
37
|
-
.env("ZUPLO")
|
|
38
|
-
.option("prompt", { type: "boolean", default: true })
|
|
39
|
-
.command(upgrade)
|
|
40
|
-
.exitProcess(false)
|
|
41
|
-
.fail((message, error) => {
|
|
42
|
-
throw error ?? new Error(message);
|
|
43
|
-
})
|
|
44
|
-
.parseAsync();
|
|
45
|
-
}
|
|
46
|
-
describe("source upgrade command compatibility", () => {
|
|
47
|
-
it("preserves the existing invocation and explicit api type", async () => {
|
|
48
|
-
await run(["upgrade"]);
|
|
49
|
-
expect(update).toHaveBeenCalledWith(expect.objectContaining({ dir: ".", prompt: true }));
|
|
50
|
-
expect(upgradeGateway).not.toHaveBeenCalled();
|
|
51
|
-
await run(["upgrade", "--type", "api"]);
|
|
52
|
-
expect(update).toHaveBeenCalledTimes(2);
|
|
53
|
-
});
|
|
54
|
-
it.each([["--type", "ai-gateway"], ["--type=ai-gateway"]])("routes type spelling %j to preview only", async (...args) => {
|
|
55
|
-
await run(["upgrade", ...args]);
|
|
56
|
-
expect(upgradeGateway).toHaveBeenCalledWith(expect.objectContaining({ type: "ai-gateway", apply: false }));
|
|
57
|
-
expect(update).not.toHaveBeenCalled();
|
|
58
|
-
});
|
|
59
|
-
it("supports the type environment variable without enabling application", async () => {
|
|
60
|
-
process.env.ZUPLO_TYPE = "ai-gateway";
|
|
61
|
-
await run(["upgrade"]);
|
|
62
|
-
expect(upgradeGateway).toHaveBeenCalledWith(expect.objectContaining({ apply: false }));
|
|
63
|
-
});
|
|
64
|
-
it.each(["--apply", "--apply=true"])("accepts explicit %s and noninteractive confirmation", async (apply) => {
|
|
65
|
-
await run(["upgrade", "--type=ai-gateway", apply, "--prompt=false"]);
|
|
66
|
-
expect(upgradeGateway).toHaveBeenCalledWith(expect.objectContaining({ apply: true, prompt: false }));
|
|
67
|
-
});
|
|
68
|
-
it("rejects an environment-only apply and unsupported types", async () => {
|
|
69
|
-
process.env.ZUPLO_APPLY = "true";
|
|
70
|
-
await expect(run(["upgrade", "--type", "ai-gateway"])).rejects.toThrow(/explicitly supplied/);
|
|
71
|
-
delete process.env.ZUPLO_APPLY;
|
|
72
|
-
await expect(run(["upgrade", "--type", "unknown"])).rejects.toThrow();
|
|
73
|
-
await expect(run(["upgrade", "--apply"])).rejects.toThrow(/requires --type/);
|
|
74
|
-
expect(update).not.toHaveBeenCalled();
|
|
75
|
-
expect(upgradeGateway).not.toHaveBeenCalled();
|
|
76
|
-
});
|
|
77
|
-
it("keeps existing dir and prompt flag spellings", async () => {
|
|
78
|
-
for (const args of [
|
|
79
|
-
["--dir", "./example", "--prompt", "false"],
|
|
80
|
-
["--dir=./example", "--prompt=false"],
|
|
81
|
-
]) {
|
|
82
|
-
await run(["upgrade", ...args]);
|
|
83
|
-
expect(update).toHaveBeenLastCalledWith(expect.objectContaining({ dir: "example", prompt: false }));
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
it.each([false, true])("preserves the blocked exit code with analytics rejection=%s", async (reject) => {
|
|
87
|
-
if (reject)
|
|
88
|
-
jest
|
|
89
|
-
.mocked(shutdownAnalytics)
|
|
90
|
-
.mockRejectedValueOnce(new Error("analytics failed"));
|
|
91
|
-
jest.mocked(upgradeGateway).mockResolvedValueOnce(2);
|
|
92
|
-
const exit = jest.spyOn(process, "exit").mockImplementation(() => {
|
|
93
|
-
throw new Error("exit");
|
|
94
|
-
});
|
|
95
|
-
await expect(run(["upgrade", "--type=ai-gateway"])).rejects.toThrow("exit");
|
|
96
|
-
expect(exit).toHaveBeenCalledWith(2);
|
|
97
|
-
exit.mockRestore();
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
//# sourceMappingURL=source-upgrade.integration.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"source-upgrade.integration.test.js","sourceRoot":"","sources":["../../../src/__tests__/integration/source-upgrade.integration.test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,OAAO,MAAM,8BAA8B,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+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AS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAC3D,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CACpB,6DAA6D,EAC7D,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,MAAM;YACR,IAAI;iBACD,MAAM,CAAC,iBAAiB,CAAC;iBACzB,qBAAqB,CAAC,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QACrD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE;YAC/D,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;QACH,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CACjE,MAAM,CACP,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;QACrC,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import yargs from \"yargs/yargs\";\nimport upgrade from \"../../cmds/source/upgrade.js\";\nimport { shutdownAnalytics } from \"../../common/analytics/lib.js\";\nimport { upgradeGateway } from \"../../source/ai-gateway/handler.js\";\nimport { update } from \"../../source/update/handler.js\";\n\njest.mock(\"../../source/update/handler.js\", () => ({\n update: jest.fn().mockResolvedValue(undefined),\n}));\njest.mock(\"../../source/ai-gateway/handler.js\", () => ({\n upgradeGateway: jest.fn().mockResolvedValue(0),\n}));\njest.mock(\"../../common/analytics/lib.js\", () => ({\n captureEvent: jest.fn().mockResolvedValue(undefined),\n shutdownAnalytics: jest.fn().mockResolvedValue(undefined),\n}));\njest.mock(\"../../common/middleware/user-identification.js\", () => ({\n identify: jest.fn(),\n}));\njest.mock(\"../../common/validators/file-system-validator.js\", () => ({\n ZuploProjectValidator: jest.fn().mockImplementation(() => ({\n validate: jest.fn().mockResolvedValue({ ok: true }),\n })),\n}));\n\nconst originalArgv = process.argv;\nconst originalEnv = { ...process.env };\nafterEach(() => {\n process.argv = originalArgv;\n for (const key of Object.keys(process.env))\n if (!(key in originalEnv)) delete process.env[key];\n Object.assign(process.env, originalEnv);\n jest.clearAllMocks();\n});\nasync function run(args: string[]) {\n process.argv = [\"node\", \"zuplo\", \"source\", ...args];\n return yargs(args)\n .env(\"ZUPLO\")\n .option(\"prompt\", { type: \"boolean\", default: true })\n .command(upgrade)\n .exitProcess(false)\n .fail((message, error) => {\n throw error ?? new Error(message);\n })\n .parseAsync();\n}\n\ndescribe(\"source upgrade command compatibility\", () => {\n it(\"preserves the existing invocation and explicit api type\", async () => {\n await run([\"upgrade\"]);\n expect(update).toHaveBeenCalledWith(\n expect.objectContaining({ dir: \".\", prompt: true })\n );\n expect(upgradeGateway).not.toHaveBeenCalled();\n await run([\"upgrade\", \"--type\", \"api\"]);\n expect(update).toHaveBeenCalledTimes(2);\n });\n it.each([[\"--type\", \"ai-gateway\"], [\"--type=ai-gateway\"]])(\n \"routes type spelling %j to preview only\",\n async (...args) => {\n await run([\"upgrade\", ...args]);\n expect(upgradeGateway).toHaveBeenCalledWith(\n expect.objectContaining({ type: \"ai-gateway\", apply: false })\n );\n expect(update).not.toHaveBeenCalled();\n }\n );\n it(\"supports the type environment variable without enabling application\", async () => {\n process.env.ZUPLO_TYPE = \"ai-gateway\";\n await run([\"upgrade\"]);\n expect(upgradeGateway).toHaveBeenCalledWith(\n expect.objectContaining({ apply: false })\n );\n });\n it.each([\"--apply\", \"--apply=true\"])(\n \"accepts explicit %s and noninteractive confirmation\",\n async (apply) => {\n await run([\"upgrade\", \"--type=ai-gateway\", apply, \"--prompt=false\"]);\n expect(upgradeGateway).toHaveBeenCalledWith(\n expect.objectContaining({ apply: true, prompt: false })\n );\n }\n );\n it(\"rejects an environment-only apply and unsupported types\", async () => {\n process.env.ZUPLO_APPLY = \"true\";\n await expect(run([\"upgrade\", \"--type\", \"ai-gateway\"])).rejects.toThrow(\n /explicitly supplied/\n );\n delete process.env.ZUPLO_APPLY;\n await expect(run([\"upgrade\", \"--type\", \"unknown\"])).rejects.toThrow();\n await expect(run([\"upgrade\", \"--apply\"])).rejects.toThrow(\n /requires --type/\n );\n expect(update).not.toHaveBeenCalled();\n expect(upgradeGateway).not.toHaveBeenCalled();\n });\n it(\"keeps existing dir and prompt flag spellings\", async () => {\n for (const args of [\n [\"--dir\", \"./example\", \"--prompt\", \"false\"],\n [\"--dir=./example\", \"--prompt=false\"],\n ]) {\n await run([\"upgrade\", ...args]);\n expect(update).toHaveBeenLastCalledWith(\n expect.objectContaining({ dir: \"example\", prompt: false })\n );\n }\n });\n it.each([false, true])(\n \"preserves the blocked exit code with analytics rejection=%s\",\n async (reject) => {\n if (reject)\n jest\n .mocked(shutdownAnalytics)\n .mockRejectedValueOnce(new Error(\"analytics failed\"));\n jest.mocked(upgradeGateway).mockResolvedValueOnce(2);\n const exit = jest.spyOn(process, \"exit\").mockImplementation(() => {\n throw new Error(\"exit\");\n });\n await expect(run([\"upgrade\", \"--type=ai-gateway\"])).rejects.toThrow(\n \"exit\"\n );\n expect(exit).toHaveBeenCalledWith(2);\n exit.mockRestore();\n }\n );\n});\n"]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import nock from "nock";
|
|
2
|
-
export declare const TEST_AUTH_TOKEN = "test-auth-token-123";
|
|
3
|
-
export declare const TEST_ACCOUNT_NAME = "test-account";
|
|
4
|
-
export declare const TEST_PROJECT_NAME = "test-project";
|
|
5
|
-
export declare const TEST_BRANCH_NAME = "main";
|
|
6
|
-
export declare const TEST_DEPLOYMENT_NAME = "test-deployment";
|
|
7
|
-
export declare const TEST_API_BASE: string;
|
|
8
|
-
export declare function setupAuthenticatedNock(scope: nock.Scope): nock.Scope;
|
|
9
|
-
export declare function setupTestEnvironment(): void;
|
|
10
|
-
export declare function cleanupTest(): void;
|
|
11
|
-
export interface CapturedRequest {
|
|
12
|
-
method: string;
|
|
13
|
-
path: string;
|
|
14
|
-
headers: Record<string, string>;
|
|
15
|
-
body?: unknown;
|
|
16
|
-
}
|
|
17
|
-
interface NockRequest {
|
|
18
|
-
method?: string;
|
|
19
|
-
path?: string;
|
|
20
|
-
headers?: Record<string, unknown>;
|
|
21
|
-
}
|
|
22
|
-
export declare class RequestCapture {
|
|
23
|
-
private requests;
|
|
24
|
-
capture(req: NockRequest, _interceptor?: unknown, body?: unknown): void;
|
|
25
|
-
getRequests(): CapturedRequest[];
|
|
26
|
-
clear(): void;
|
|
27
|
-
private normalizeHeaders;
|
|
28
|
-
}
|
|
29
|
-
export {};
|
|
30
|
-
//# sourceMappingURL=test-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/test-utils.ts"],"names":[],"mappings":"AAGA,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,eAAO,MAAM,eAAe,wBAAwB,CAAC;AACrD,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAChD,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAChD,eAAO,MAAM,gBAAgB,SAAS,CAAC;AACvC,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AAGtD,eAAO,MAAM,aAAa,QAAwC,CAAC;AAKnE,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAEpE;AAKD,wBAAgB,oBAAoB,SAWnC;AAKD,wBAAgB,WAAW,SAM1B;AAKD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAyB;IAEzC,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI;IAuBvE,WAAW,IAAI,eAAe,EAAE;IAIhC,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,gBAAgB;CA6BzB"}
|