@noldova/desktop.runtime 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/README.md +82 -2
- package/api/index.d.ts +16401 -0
- package/api/index.js +256 -0
- package/api/index.js.map +1 -0
- package/api/testing.d.ts +2128 -0
- package/api/testing.js +20 -0
- package/api/testing.js.map +1 -0
- package/enums/agent-control-failure.js +13 -0
- package/enums/agent-control-failure.js.map +1 -0
- package/enums/build-relation.js +14 -0
- package/enums/build-relation.js.map +1 -0
- package/enums/data-directory-state.js +14 -0
- package/enums/data-directory-state.js.map +1 -0
- package/enums/endpoint-kind.js +13 -0
- package/enums/endpoint-kind.js.map +1 -0
- package/enums/permission-decision.js +18 -0
- package/enums/permission-decision.js.map +1 -0
- package/enums/permission-detail-kind.js +15 -0
- package/enums/permission-detail-kind.js.map +1 -0
- package/enums/permission-option.js +16 -0
- package/enums/permission-option.js.map +1 -0
- package/enums/session-state.js +17 -0
- package/enums/session-state.js.map +1 -0
- package/enums/tool-abort-reason.js +16 -0
- package/enums/tool-abort-reason.js.map +1 -0
- package/enums/tool-content-kind.js +13 -0
- package/enums/tool-content-kind.js.map +1 -0
- package/enums/tool-failure-code.js +22 -0
- package/enums/tool-failure-code.js.map +1 -0
- package/enums/tool-risk.js +14 -0
- package/enums/tool-risk.js.map +1 -0
- package/enums/unknown-schema-failure.js +14 -0
- package/enums/unknown-schema-failure.js.map +1 -0
- package/enums/update-barrier-state.js +14 -0
- package/enums/update-barrier-state.js.map +1 -0
- package/enums/update-barrier-status.js +14 -0
- package/enums/update-barrier-status.js.map +1 -0
- package/enums/window-state-kind.js +13 -0
- package/enums/window-state-kind.js.map +1 -0
- package/exceptions/addon-incomplete.exception.js +17 -0
- package/exceptions/addon-incomplete.exception.js.map +1 -0
- package/exceptions/addon-load-failed.exception.js +17 -0
- package/exceptions/addon-load-failed.exception.js.map +1 -0
- package/exceptions/addon-load.exception.js +14 -0
- package/exceptions/addon-load.exception.js.map +1 -0
- package/exceptions/addon-missing.exception.js +19 -0
- package/exceptions/addon-missing.exception.js.map +1 -0
- package/exceptions/addon-unexpected-value.exception.js +17 -0
- package/exceptions/addon-unexpected-value.exception.js.map +1 -0
- package/exceptions/agent-control.exception.js +28 -0
- package/exceptions/agent-control.exception.js.map +1 -0
- package/exceptions/answerer-registered.exception.js +10 -0
- package/exceptions/answerer-registered.exception.js.map +1 -0
- package/exceptions/app-image-copy-unavailable.exception.js +17 -0
- package/exceptions/app-image-copy-unavailable.exception.js.map +1 -0
- package/exceptions/app-image-copy-unlisted.exception.js +17 -0
- package/exceptions/app-image-copy-unlisted.exception.js.map +1 -0
- package/exceptions/backup-verification.exception.js +15 -0
- package/exceptions/backup-verification.exception.js.map +1 -0
- package/exceptions/batch-argument-refused.exception.js +17 -0
- package/exceptions/batch-argument-refused.exception.js.map +1 -0
- package/exceptions/batch-system-root-missing.exception.js +15 -0
- package/exceptions/batch-system-root-missing.exception.js.map +1 -0
- package/exceptions/build-mismatch.exception.js +18 -0
- package/exceptions/build-mismatch.exception.js.map +1 -0
- package/exceptions/call-unanswered.exception.js +17 -0
- package/exceptions/call-unanswered.exception.js.map +1 -0
- package/exceptions/command-failed.exception.js +18 -0
- package/exceptions/command-failed.exception.js.map +1 -0
- package/exceptions/command-registered.exception.js +10 -0
- package/exceptions/command-registered.exception.js.map +1 -0
- package/exceptions/connection-closed.exception.js +16 -0
- package/exceptions/connection-closed.exception.js.map +1 -0
- package/exceptions/connection-refused.exception.js +14 -0
- package/exceptions/connection-refused.exception.js.map +1 -0
- package/exceptions/connection.exception.js +16 -0
- package/exceptions/connection.exception.js.map +1 -0
- package/exceptions/data-directory-owned.exception.js +18 -0
- package/exceptions/data-directory-owned.exception.js.map +1 -0
- package/exceptions/declaration-field-invalid.exception.js +10 -0
- package/exceptions/declaration-field-invalid.exception.js.map +1 -0
- package/exceptions/declaration-not-object.exception.js +8 -0
- package/exceptions/declaration-not-object.exception.js.map +1 -0
- package/exceptions/declarations-format.exception.js +14 -0
- package/exceptions/declarations-format.exception.js.map +1 -0
- package/exceptions/declarations-unreadable.exception.js +18 -0
- package/exceptions/declarations-unreadable.exception.js.map +1 -0
- package/exceptions/declarations-version-unsupported.exception.js +10 -0
- package/exceptions/declarations-version-unsupported.exception.js.map +1 -0
- package/exceptions/discovery-field-invalid.exception.js +10 -0
- package/exceptions/discovery-field-invalid.exception.js.map +1 -0
- package/exceptions/discovery-format.exception.js +14 -0
- package/exceptions/discovery-format.exception.js.map +1 -0
- package/exceptions/discovery-not-object.exception.js +8 -0
- package/exceptions/discovery-not-object.exception.js.map +1 -0
- package/exceptions/discovery-unreadable.exception.js +18 -0
- package/exceptions/discovery-unreadable.exception.js.map +1 -0
- package/exceptions/discovery-version-unsupported.exception.js +10 -0
- package/exceptions/discovery-version-unsupported.exception.js.map +1 -0
- package/exceptions/endpoint-unavailable.exception.js +15 -0
- package/exceptions/endpoint-unavailable.exception.js.map +1 -0
- package/exceptions/environment-unreadable.exception.js +15 -0
- package/exceptions/environment-unreadable.exception.js.map +1 -0
- package/exceptions/event-declared.exception.js +10 -0
- package/exceptions/event-declared.exception.js.map +1 -0
- package/exceptions/event-withdrawn.exception.js +10 -0
- package/exceptions/event-withdrawn.exception.js.map +1 -0
- package/exceptions/exit-code-unreadable.exception.js +17 -0
- package/exceptions/exit-code-unreadable.exception.js.map +1 -0
- package/exceptions/exit-wait-timed-out.exception.js +19 -0
- package/exceptions/exit-wait-timed-out.exception.js.map +1 -0
- package/exceptions/folder-not-private.exception.js +19 -0
- package/exceptions/folder-not-private.exception.js.map +1 -0
- package/exceptions/foreground-group-read-failed.exception.js +18 -0
- package/exceptions/foreground-group-read-failed.exception.js.map +1 -0
- package/exceptions/foreground-group-unreadable.exception.js +19 -0
- package/exceptions/foreground-group-unreadable.exception.js.map +1 -0
- package/exceptions/handshake-closed.exception.js +15 -0
- package/exceptions/handshake-closed.exception.js.map +1 -0
- package/exceptions/handshake-identity-mismatch.exception.js +15 -0
- package/exceptions/handshake-identity-mismatch.exception.js.map +1 -0
- package/exceptions/handshake-timed-out.exception.js +15 -0
- package/exceptions/handshake-timed-out.exception.js.map +1 -0
- package/exceptions/job-assignment-failed.exception.js +19 -0
- package/exceptions/job-assignment-failed.exception.js.map +1 -0
- package/exceptions/job-closed-before-exit.exception.js +17 -0
- package/exceptions/job-closed-before-exit.exception.js.map +1 -0
- package/exceptions/launch-descriptors-unavailable.exception.js +15 -0
- package/exceptions/launch-descriptors-unavailable.exception.js.map +1 -0
- package/exceptions/launch-limit-reached.exception.js +17 -0
- package/exceptions/launch-limit-reached.exception.js.map +1 -0
- package/exceptions/launch-shell-unavailable.exception.js +15 -0
- package/exceptions/launch-shell-unavailable.exception.js.map +1 -0
- package/exceptions/launch-start-failed.exception.js +17 -0
- package/exceptions/launch-start-failed.exception.js.map +1 -0
- package/exceptions/launch-timed-out.exception.js +15 -0
- package/exceptions/launch-timed-out.exception.js.map +1 -0
- package/exceptions/launch.exception.js +14 -0
- package/exceptions/launch.exception.js.map +1 -0
- package/exceptions/main-process-refused-again.exception.js +15 -0
- package/exceptions/main-process-refused-again.exception.js.map +1 -0
- package/exceptions/method-failure.exception.js +16 -0
- package/exceptions/method-failure.exception.js.map +1 -0
- package/exceptions/method-registered.exception.js +10 -0
- package/exceptions/method-registered.exception.js.map +1 -0
- package/exceptions/migration.exception.js +17 -0
- package/exceptions/migration.exception.js.map +1 -0
- package/exceptions/module-activation.exception.js +17 -0
- package/exceptions/module-activation.exception.js.map +1 -0
- package/exceptions/module-database.exception.js +17 -0
- package/exceptions/module-database.exception.js.map +1 -0
- package/exceptions/module-id-device.exception.js +10 -0
- package/exceptions/module-id-device.exception.js.map +1 -0
- package/exceptions/module-load.exception.js +15 -0
- package/exceptions/module-load.exception.js.map +1 -0
- package/exceptions/module-stopping.exception.js +19 -0
- package/exceptions/module-stopping.exception.js.map +1 -0
- package/exceptions/move-aside-refused.exception.js +17 -0
- package/exceptions/move-aside-refused.exception.js.map +1 -0
- package/exceptions/no-job-for-exit-code.exception.js +17 -0
- package/exceptions/no-job-for-exit-code.exception.js.map +1 -0
- package/exceptions/no-runtime.exception.js +17 -0
- package/exceptions/no-runtime.exception.js.map +1 -0
- package/exceptions/not-contributed.exception.js +14 -0
- package/exceptions/not-contributed.exception.js.map +1 -0
- package/exceptions/notification-command-not-allowed.exception.js +12 -0
- package/exceptions/notification-command-not-allowed.exception.js.map +1 -0
- package/exceptions/notification-kind-changed.exception.js +12 -0
- package/exceptions/notification-kind-changed.exception.js.map +1 -0
- package/exceptions/ownership-released.exception.js +15 -0
- package/exceptions/ownership-released.exception.js.map +1 -0
- package/exceptions/permission-access.exception.js +14 -0
- package/exceptions/permission-access.exception.js.map +1 -0
- package/exceptions/permissions-closed.exception.js +8 -0
- package/exceptions/permissions-closed.exception.js.map +1 -0
- package/exceptions/permissions-module-only.exception.js +10 -0
- package/exceptions/permissions-module-only.exception.js.map +1 -0
- package/exceptions/pre-shell-data-found.exception.js +18 -0
- package/exceptions/pre-shell-data-found.exception.js.map +1 -0
- package/exceptions/pre-shell-data.exception.js +19 -0
- package/exceptions/pre-shell-data.exception.js.map +1 -0
- package/exceptions/process-start-failed.exception.js +17 -0
- package/exceptions/process-start-failed.exception.js.map +1 -0
- package/exceptions/process-start.exception.js +14 -0
- package/exceptions/process-start.exception.js.map +1 -0
- package/exceptions/process-table-row-unreadable.exception.js +17 -0
- package/exceptions/process-table-row-unreadable.exception.js.map +1 -0
- package/exceptions/product-file.exception.js +18 -0
- package/exceptions/product-file.exception.js.map +1 -0
- package/exceptions/program-not-found.exception.js +17 -0
- package/exceptions/program-not-found.exception.js.map +1 -0
- package/exceptions/program-path-relative.exception.js +17 -0
- package/exceptions/program-path-relative.exception.js.map +1 -0
- package/exceptions/pseudo-terminal-batch-refused.exception.js +17 -0
- package/exceptions/pseudo-terminal-batch-refused.exception.js.map +1 -0
- package/exceptions/pseudo-terminal-command-line-batch-refused.exception.js +17 -0
- package/exceptions/pseudo-terminal-command-line-batch-refused.exception.js.map +1 -0
- package/exceptions/pseudo-terminal-command-line-refused.exception.js +17 -0
- package/exceptions/pseudo-terminal-command-line-refused.exception.js.map +1 -0
- package/exceptions/pseudo-terminal-command-line-with-arguments.exception.js +17 -0
- package/exceptions/pseudo-terminal-command-line-with-arguments.exception.js.map +1 -0
- package/exceptions/pseudo-terminals-undeclared.exception.js +19 -0
- package/exceptions/pseudo-terminals-undeclared.exception.js.map +1 -0
- package/exceptions/registration.exception.js +14 -0
- package/exceptions/registration.exception.js.map +1 -0
- package/exceptions/runtime-exited-without-reason.exception.js +15 -0
- package/exceptions/runtime-exited-without-reason.exception.js.map +1 -0
- package/exceptions/runtime-exited.exception.js +17 -0
- package/exceptions/runtime-exited.exception.js.map +1 -0
- package/exceptions/runtime-handover.exception.js +18 -0
- package/exceptions/runtime-handover.exception.js.map +1 -0
- package/exceptions/runtime-unreachable.exception.js +17 -0
- package/exceptions/runtime-unreachable.exception.js.map +1 -0
- package/exceptions/runtime.exception.js +14 -0
- package/exceptions/runtime.exception.js.map +1 -0
- package/exceptions/secret-not-owned.exception.js +12 -0
- package/exceptions/secret-not-owned.exception.js.map +1 -0
- package/exceptions/service-access.exception.js +14 -0
- package/exceptions/service-access.exception.js.map +1 -0
- package/exceptions/service-missing.exception.js +10 -0
- package/exceptions/service-missing.exception.js.map +1 -0
- package/exceptions/service-not-allowed.exception.js +12 -0
- package/exceptions/service-not-allowed.exception.js.map +1 -0
- package/exceptions/service-not-owned.exception.js +12 -0
- package/exceptions/service-not-owned.exception.js.map +1 -0
- package/exceptions/service-published.exception.js +10 -0
- package/exceptions/service-published.exception.js.map +1 -0
- package/exceptions/service-type-mismatch.exception.js +12 -0
- package/exceptions/service-type-mismatch.exception.js.map +1 -0
- package/exceptions/setting-needs-device.exception.js +11 -0
- package/exceptions/setting-needs-device.exception.js.map +1 -0
- package/exceptions/setting-not-readable.exception.js +12 -0
- package/exceptions/setting-not-readable.exception.js.map +1 -0
- package/exceptions/setting-not-writable.exception.js +12 -0
- package/exceptions/setting-not-writable.exception.js.map +1 -0
- package/exceptions/setting-scope-not-allowed.exception.js +13 -0
- package/exceptions/setting-scope-not-allowed.exception.js.map +1 -0
- package/exceptions/setting-scope-not-owned.exception.js +12 -0
- package/exceptions/setting-scope-not-owned.exception.js.map +1 -0
- package/exceptions/setting-unknown.exception.js +11 -0
- package/exceptions/setting-unknown.exception.js.map +1 -0
- package/exceptions/setting-value-invalid.exception.js +11 -0
- package/exceptions/setting-value-invalid.exception.js.map +1 -0
- package/exceptions/setting.exception.js +14 -0
- package/exceptions/setting.exception.js.map +1 -0
- package/exceptions/stop-refused.exception.js +17 -0
- package/exceptions/stop-refused.exception.js.map +1 -0
- package/exceptions/stop-timed-out.exception.js +15 -0
- package/exceptions/stop-timed-out.exception.js.map +1 -0
- package/exceptions/system-command.exception.js +14 -0
- package/exceptions/system-command.exception.js.map +1 -0
- package/exceptions/system-root-missing.exception.js +15 -0
- package/exceptions/system-root-missing.exception.js.map +1 -0
- package/exceptions/tool-endpoint.exception.js +15 -0
- package/exceptions/tool-endpoint.exception.js.map +1 -0
- package/exceptions/tool-failure.exception.js +16 -0
- package/exceptions/tool-failure.exception.js.map +1 -0
- package/exceptions/tool-registered.exception.js +10 -0
- package/exceptions/tool-registered.exception.js.map +1 -0
- package/exceptions/unknown-schema.exception.js +30 -0
- package/exceptions/unknown-schema.exception.js.map +1 -0
- package/exceptions/update-in-progress.exception.js +19 -0
- package/exceptions/update-in-progress.exception.js.map +1 -0
- package/exceptions/update-preparing.exception.js +19 -0
- package/exceptions/update-preparing.exception.js.map +1 -0
- package/exceptions/user-identity-unreadable.exception.js +17 -0
- package/exceptions/user-identity-unreadable.exception.js.map +1 -0
- package/exceptions/verbatim-batch-refused.exception.js +17 -0
- package/exceptions/verbatim-batch-refused.exception.js.map +1 -0
- package/exceptions/web-view-failure.exception.js +17 -0
- package/exceptions/web-view-failure.exception.js.map +1 -0
- package/exceptions/work-in-progress.exception.js +17 -0
- package/exceptions/work-in-progress.exception.js.map +1 -0
- package/interfaces/i-app-shortcuts.js +9 -0
- package/interfaces/i-app-shortcuts.js.map +1 -0
- package/interfaces/i-app-windows.js +9 -0
- package/interfaces/i-app-windows.js.map +1 -0
- package/interfaces/i-environment-source.js +9 -0
- package/interfaces/i-environment-source.js.map +1 -0
- package/interfaces/i-event-sink.js +9 -0
- package/interfaces/i-event-sink.js.map +1 -0
- package/interfaces/i-file-share-options.js +9 -0
- package/interfaces/i-file-share-options.js.map +1 -0
- package/interfaces/i-folder-protector.js +9 -0
- package/interfaces/i-folder-protector.js.map +1 -0
- package/interfaces/i-idle-participant.js +9 -0
- package/interfaces/i-idle-participant.js.map +1 -0
- package/interfaces/i-issued-grant.js +9 -0
- package/interfaces/i-issued-grant.js.map +1 -0
- package/interfaces/i-line-process-listener.js +9 -0
- package/interfaces/i-line-process-listener.js.map +1 -0
- package/interfaces/i-line-process-starter.js +9 -0
- package/interfaces/i-line-process-starter.js.map +1 -0
- package/interfaces/i-line-process.js +9 -0
- package/interfaces/i-line-process.js.map +1 -0
- package/interfaces/i-main-process-check.js +9 -0
- package/interfaces/i-main-process-check.js.map +1 -0
- package/interfaces/i-method-handler.js +9 -0
- package/interfaces/i-method-handler.js.map +1 -0
- package/interfaces/i-module-database.js +9 -0
- package/interfaces/i-module-database.js.map +1 -0
- package/interfaces/i-module-log.js +9 -0
- package/interfaces/i-module-log.js.map +1 -0
- package/interfaces/i-module-secrets.js +9 -0
- package/interfaces/i-module-secrets.js.map +1 -0
- package/interfaces/i-module-settings.js +9 -0
- package/interfaces/i-module-settings.js.map +1 -0
- package/interfaces/i-peer-process-api.js +9 -0
- package/interfaces/i-peer-process-api.js.map +1 -0
- package/interfaces/i-permission-answerer.js +9 -0
- package/interfaces/i-permission-answerer.js.map +1 -0
- package/interfaces/i-permission-detail.js +9 -0
- package/interfaces/i-permission-detail.js.map +1 -0
- package/interfaces/i-permission-request.js +9 -0
- package/interfaces/i-permission-request.js.map +1 -0
- package/interfaces/i-permissions-context.js +9 -0
- package/interfaces/i-permissions-context.js.map +1 -0
- package/interfaces/i-posix-process-addon.js +9 -0
- package/interfaces/i-posix-process-addon.js.map +1 -0
- package/interfaces/i-posix-process-api.js +9 -0
- package/interfaces/i-posix-process-api.js.map +1 -0
- package/interfaces/i-posix-process-table-api.js +9 -0
- package/interfaces/i-posix-process-table-api.js.map +1 -0
- package/interfaces/i-process-ender.js +9 -0
- package/interfaces/i-process-ender.js.map +1 -0
- package/interfaces/i-process-starter.js +9 -0
- package/interfaces/i-process-starter.js.map +1 -0
- package/interfaces/i-process-table.reader.js +9 -0
- package/interfaces/i-process-table.reader.js.map +1 -0
- package/interfaces/i-profile-watch.js +9 -0
- package/interfaces/i-profile-watch.js.map +1 -0
- package/interfaces/i-pseudo-terminal-exit.js +9 -0
- package/interfaces/i-pseudo-terminal-exit.js.map +1 -0
- package/interfaces/i-pseudo-terminal-handle.js +9 -0
- package/interfaces/i-pseudo-terminal-handle.js.map +1 -0
- package/interfaces/i-pseudo-terminal-library.js +9 -0
- package/interfaces/i-pseudo-terminal-library.js.map +1 -0
- package/interfaces/i-pseudo-terminal-options.js +9 -0
- package/interfaces/i-pseudo-terminal-options.js.map +1 -0
- package/interfaces/i-pseudo-terminal-start-options.js +9 -0
- package/interfaces/i-pseudo-terminal-start-options.js.map +1 -0
- package/interfaces/i-pseudo-terminal-subscription.js +9 -0
- package/interfaces/i-pseudo-terminal-subscription.js.map +1 -0
- package/interfaces/i-resolved-file.js +9 -0
- package/interfaces/i-resolved-file.js.map +1 -0
- package/interfaces/i-runtime-client-listener.js +9 -0
- package/interfaces/i-runtime-client-listener.js.map +1 -0
- package/interfaces/i-runtime-discovery-json.js +9 -0
- package/interfaces/i-runtime-discovery-json.js.map +1 -0
- package/interfaces/i-runtime-files.js +9 -0
- package/interfaces/i-runtime-files.js.map +1 -0
- package/interfaces/i-runtime-part-context.js +9 -0
- package/interfaces/i-runtime-part-context.js.map +1 -0
- package/interfaces/i-runtime-part-loader.js +9 -0
- package/interfaces/i-runtime-part-loader.js.map +1 -0
- package/interfaces/i-runtime-part.js +9 -0
- package/interfaces/i-runtime-part.js.map +1 -0
- package/interfaces/i-runtime-web-views.js +9 -0
- package/interfaces/i-runtime-web-views.js.map +1 -0
- package/interfaces/i-secret-backend.js +9 -0
- package/interfaces/i-secret-backend.js.map +1 -0
- package/interfaces/i-session-listener.js +9 -0
- package/interfaces/i-session-listener.js.map +1 -0
- package/interfaces/i-tool-call-options.js +9 -0
- package/interfaces/i-tool-call-options.js.map +1 -0
- package/interfaces/i-tool-call-permissions.js +9 -0
- package/interfaces/i-tool-call-permissions.js.map +1 -0
- package/interfaces/i-tool-deadline.js +9 -0
- package/interfaces/i-tool-deadline.js.map +1 -0
- package/interfaces/i-tool-descriptor.js +9 -0
- package/interfaces/i-tool-descriptor.js.map +1 -0
- package/interfaces/i-tool-endpoint-handler.js +9 -0
- package/interfaces/i-tool-endpoint-handler.js.map +1 -0
- package/interfaces/i-tool-endpoint.js +9 -0
- package/interfaces/i-tool-endpoint.js.map +1 -0
- package/interfaces/i-tool-handler.js +9 -0
- package/interfaces/i-tool-handler.js.map +1 -0
- package/interfaces/i-tool-hints.js +9 -0
- package/interfaces/i-tool-hints.js.map +1 -0
- package/interfaces/i-tool-limits.js +9 -0
- package/interfaces/i-tool-limits.js.map +1 -0
- package/interfaces/i-tool-risk-range.js +9 -0
- package/interfaces/i-tool-risk-range.js.map +1 -0
- package/interfaces/i-tool-schema.validator.js +2 -0
- package/interfaces/i-tool-schema.validator.js.map +1 -0
- package/interfaces/i-tool-session-host.js +9 -0
- package/interfaces/i-tool-session-host.js.map +1 -0
- package/interfaces/i-tools-context.js +9 -0
- package/interfaces/i-tools-context.js.map +1 -0
- package/interfaces/i-web-view-relay.js +9 -0
- package/interfaces/i-web-view-relay.js.map +1 -0
- package/interfaces/i-windows-peer-addon.js +9 -0
- package/interfaces/i-windows-peer-addon.js.map +1 -0
- package/interfaces/i-windows-process-addon.js +9 -0
- package/interfaces/i-windows-process-addon.js.map +1 -0
- package/interfaces/i-windows-process-api.js +9 -0
- package/interfaces/i-windows-process-api.js.map +1 -0
- package/interfaces/i-windows-signature.js +9 -0
- package/interfaces/i-windows-signature.js.map +1 -0
- package/models/app-image-copy-record.js +49 -0
- package/models/app-image-copy-record.js.map +1 -0
- package/models/app-image-source.js +48 -0
- package/models/app-image-source.js.map +1 -0
- package/models/attach-options.js +16 -0
- package/models/attach-options.js.map +1 -0
- package/models/capability-token.js +29 -0
- package/models/capability-token.js.map +1 -0
- package/models/caught-failure.js +15 -0
- package/models/caught-failure.js.map +1 -0
- package/models/client-closure.js +16 -0
- package/models/client-closure.js.map +1 -0
- package/models/client-settings.js +26 -0
- package/models/client-settings.js.map +1 -0
- package/models/connected-client.js +16 -0
- package/models/connected-client.js.map +1 -0
- package/models/data-directory-inspection.js +16 -0
- package/models/data-directory-inspection.js.map +1 -0
- package/models/endpoint.js +46 -0
- package/models/endpoint.js.map +1 -0
- package/models/event-channel.js +25 -0
- package/models/event-channel.js.map +1 -0
- package/models/granted-file.js +41 -0
- package/models/granted-file.js.map +1 -0
- package/models/image-size.js +22 -0
- package/models/image-size.js.map +1 -0
- package/models/kept-program.js +16 -0
- package/models/kept-program.js.map +1 -0
- package/models/launch-settings.js +44 -0
- package/models/launch-settings.js.map +1 -0
- package/models/migration.js +22 -0
- package/models/migration.js.map +1 -0
- package/models/module-activation.js +23 -0
- package/models/module-activation.js.map +1 -0
- package/models/module-declaration.js +203 -0
- package/models/module-declaration.js.map +1 -0
- package/models/notification-handle.js +24 -0
- package/models/notification-handle.js.map +1 -0
- package/models/owned-process.js +42 -0
- package/models/owned-process.js.map +1 -0
- package/models/packaged-path.js +14 -0
- package/models/packaged-path.js.map +1 -0
- package/models/peer-process.js +18 -0
- package/models/peer-process.js.map +1 -0
- package/models/pending-call.js +28 -0
- package/models/pending-call.js.map +1 -0
- package/models/permission-outcome.js +22 -0
- package/models/permission-outcome.js.map +1 -0
- package/models/permission-question.js +23 -0
- package/models/permission-question.js.map +1 -0
- package/models/permission-record.js +23 -0
- package/models/permission-record.js.map +1 -0
- package/models/permission-revocation.js +18 -0
- package/models/permission-revocation.js.map +1 -0
- package/models/process-ending.js +24 -0
- package/models/process-ending.js.map +1 -0
- package/models/process-exit.js +24 -0
- package/models/process-exit.js.map +1 -0
- package/models/process-killing.js +20 -0
- package/models/process-killing.js.map +1 -0
- package/models/process-launch-command.js +46 -0
- package/models/process-launch-command.js.map +1 -0
- package/models/process-launch.js +21 -0
- package/models/process-launch.js.map +1 -0
- package/models/process-record.js +41 -0
- package/models/process-record.js.map +1 -0
- package/models/process-request.js +40 -0
- package/models/process-request.js.map +1 -0
- package/models/process-settings.js +31 -0
- package/models/process-settings.js.map +1 -0
- package/models/process-table-entry.js +30 -0
- package/models/process-table-entry.js.map +1 -0
- package/models/process-table.js +55 -0
- package/models/process-table.js.map +1 -0
- package/models/product-info.js +68 -0
- package/models/product-info.js.map +1 -0
- package/models/pseudo-terminal-console.js +41 -0
- package/models/pseudo-terminal-console.js.map +1 -0
- package/models/pseudo-terminal-exit.js +24 -0
- package/models/pseudo-terminal-exit.js.map +1 -0
- package/models/pseudo-terminal-request.js +44 -0
- package/models/pseudo-terminal-request.js.map +1 -0
- package/models/pseudo-terminal.js +104 -0
- package/models/pseudo-terminal.js.map +1 -0
- package/models/refusal.js +16 -0
- package/models/refusal.js.map +1 -0
- package/models/registered-tool.js +22 -0
- package/models/registered-tool.js.map +1 -0
- package/models/registration.js +17 -0
- package/models/registration.js.map +1 -0
- package/models/remembered-permission.js +26 -0
- package/models/remembered-permission.js.map +1 -0
- package/models/request-context.js +27 -0
- package/models/request-context.js.map +1 -0
- package/models/running-process.js +25 -0
- package/models/running-process.js.map +1 -0
- package/models/running-program.js +26 -0
- package/models/running-program.js.map +1 -0
- package/models/running-tool-call.js +111 -0
- package/models/running-tool-call.js.map +1 -0
- package/models/runtime-build.js +17 -0
- package/models/runtime-build.js.map +1 -0
- package/models/runtime-command.js +39 -0
- package/models/runtime-command.js.map +1 -0
- package/models/runtime-discovery.js +85 -0
- package/models/runtime-discovery.js.map +1 -0
- package/models/runtime-options.js +63 -0
- package/models/runtime-options.js.map +1 -0
- package/models/server-settings.js +34 -0
- package/models/server-settings.js.map +1 -0
- package/models/started-runtime.js +29 -0
- package/models/started-runtime.js.map +1 -0
- package/models/system-error-code.js +29 -0
- package/models/system-error-code.js.map +1 -0
- package/models/terminal-size.js +19 -0
- package/models/terminal-size.js.map +1 -0
- package/models/tool-call.js +65 -0
- package/models/tool-call.js.map +1 -0
- package/models/tool-content.js +44 -0
- package/models/tool-content.js.map +1 -0
- package/models/tool-descriptor.js +104 -0
- package/models/tool-descriptor.js.map +1 -0
- package/models/tool-failure.js +39 -0
- package/models/tool-failure.js.map +1 -0
- package/models/tool-result.js +22 -0
- package/models/tool-result.js.map +1 -0
- package/models/tool-session.js +29 -0
- package/models/tool-session.js.map +1 -0
- package/models/tool-turns.js +31 -0
- package/models/tool-turns.js.map +1 -0
- package/models/update-barrier.js +39 -0
- package/models/update-barrier.js.map +1 -0
- package/models/watched-pseudo-terminal-handle.js +118 -0
- package/models/watched-pseudo-terminal-handle.js.map +1 -0
- package/models/web-view-protocol-event.js +20 -0
- package/models/web-view-protocol-event.js.map +1 -0
- package/models/windows-device-names.js +15 -0
- package/models/windows-device-names.js.map +1 -0
- package/models/work-item.js +29 -0
- package/models/work-item.js.map +1 -0
- package/native/darwin-arm64/posix-process.node +0 -0
- package/native/darwin-x64/posix-process.node +0 -0
- package/native/linux-arm64/posix-process.node +0 -0
- package/native/linux-x64/posix-process.node +0 -0
- package/native/win32-arm64/windows-process.node +0 -0
- package/native/win32-x64/windows-process.node +0 -0
- package/package.json +53 -3
- package/resources.js +1784 -0
- package/resources.js.map +1 -0
- package/services/app-surface/app-shortcuts-changed-method.js +24 -0
- package/services/app-surface/app-shortcuts-changed-method.js.map +1 -0
- package/services/app-surface/app-surface.js +57 -0
- package/services/app-surface/app-surface.js.map +1 -0
- package/services/app-surface/app-windows-changed-method.js +24 -0
- package/services/app-surface/app-windows-changed-method.js.map +1 -0
- package/services/app-surface/main-window-changed-method.js +24 -0
- package/services/app-surface/main-window-changed-method.js.map +1 -0
- package/services/app-surface/main-window-method.js +10 -0
- package/services/app-surface/main-window-method.js.map +1 -0
- package/services/app-surface/module-app-shortcuts.js +27 -0
- package/services/app-surface/module-app-shortcuts.js.map +1 -0
- package/services/app-surface/module-app-windows.js +24 -0
- package/services/app-surface/module-app-windows.js.map +1 -0
- package/services/app-surface/reported-list.js +61 -0
- package/services/app-surface/reported-list.js.map +1 -0
- package/services/client/app-image-copy-launch.js +187 -0
- package/services/client/app-image-copy-launch.js.map +1 -0
- package/services/client/app-image-extraction.js +39 -0
- package/services/client/app-image-extraction.js.map +1 -0
- package/services/client/app-image-keepalive.js +63 -0
- package/services/client/app-image-keepalive.js.map +1 -0
- package/services/client/build-comparer.js +25 -0
- package/services/client/build-comparer.js.map +1 -0
- package/services/client/runtime-client.js +203 -0
- package/services/client/runtime-client.js.map +1 -0
- package/services/client/runtime-launcher.js +259 -0
- package/services/client/runtime-launcher.js.map +1 -0
- package/services/commands/shell-commands.js +18 -0
- package/services/commands/shell-commands.js.map +1 -0
- package/services/commands/system-command.js +31 -0
- package/services/commands/system-command.js.map +1 -0
- package/services/data-directory/data-directory-inspector.js +49 -0
- package/services/data-directory/data-directory-inspector.js.map +1 -0
- package/services/data-directory/data-directory-locator.js +25 -0
- package/services/data-directory/data-directory-locator.js.map +1 -0
- package/services/data-directory/data-directory.js +85 -0
- package/services/data-directory/data-directory.js.map +1 -0
- package/services/database/backup-guard.js +64 -0
- package/services/database/backup-guard.js.map +1 -0
- package/services/database/database-backup.js +122 -0
- package/services/database/database-backup.js.map +1 -0
- package/services/database/migrated-database.js +198 -0
- package/services/database/migrated-database.js.map +1 -0
- package/services/database/module-database.js +21 -0
- package/services/database/module-database.js.map +1 -0
- package/services/database/shell-database.js +25 -0
- package/services/database/shell-database.js.map +1 -0
- package/services/database/shell-migrations.js +22 -0
- package/services/database/shell-migrations.js.map +1 -0
- package/services/database/update-backup.js +57 -0
- package/services/database/update-backup.js.map +1 -0
- package/services/diagnostics/diagnostic-redactor.js +75 -0
- package/services/diagnostics/diagnostic-redactor.js.map +1 -0
- package/services/diagnostics/log-file.js +56 -0
- package/services/diagnostics/log-file.js.map +1 -0
- package/services/diagnostics/log-text.js +15 -0
- package/services/diagnostics/log-text.js.map +1 -0
- package/services/diagnostics/standard-error-cap.js +107 -0
- package/services/diagnostics/standard-error-cap.js.map +1 -0
- package/services/discovery/discovery-publisher.js +64 -0
- package/services/discovery/discovery-publisher.js.map +1 -0
- package/services/discovery/discovery.reader.js +44 -0
- package/services/discovery/discovery.reader.js.map +1 -0
- package/services/discovery/folder-protector-factory.js +19 -0
- package/services/discovery/folder-protector-factory.js.map +1 -0
- package/services/discovery/mac-folder-protector.js +37 -0
- package/services/discovery/mac-folder-protector.js.map +1 -0
- package/services/discovery/posix-folder-protector.js +15 -0
- package/services/discovery/posix-folder-protector.js.map +1 -0
- package/services/discovery/windows-folder-protector.js +57 -0
- package/services/discovery/windows-folder-protector.js.map +1 -0
- package/services/endpoint/client-closures.js +27 -0
- package/services/endpoint/client-closures.js.map +1 -0
- package/services/endpoint/client-session.js +120 -0
- package/services/endpoint/client-session.js.map +1 -0
- package/services/endpoint/main-process-check.js +48 -0
- package/services/endpoint/main-process-check.js.map +1 -0
- package/services/endpoint/runtime-server.js +355 -0
- package/services/endpoint/runtime-server.js.map +1 -0
- package/services/endpoint/window-closed-method.js +19 -0
- package/services/endpoint/window-closed-method.js.map +1 -0
- package/services/environment/current-environment.js +43 -0
- package/services/environment/current-environment.js.map +1 -0
- package/services/environment/line-process-starter.js +21 -0
- package/services/environment/line-process-starter.js.map +1 -0
- package/services/environment/line-process.js +83 -0
- package/services/environment/line-process.js.map +1 -0
- package/services/environment/login-shell-environment.js +162 -0
- package/services/environment/login-shell-environment.js.map +1 -0
- package/services/environment/profile-watch.js +247 -0
- package/services/environment/profile-watch.js.map +1 -0
- package/services/environment/windows-environment.js +181 -0
- package/services/environment/windows-environment.js.map +1 -0
- package/services/files/discard-file-grants-method.js +24 -0
- package/services/files/discard-file-grants-method.js.map +1 -0
- package/services/files/end-file-grants-method.js +25 -0
- package/services/files/end-file-grants-method.js.map +1 -0
- package/services/files/file-grant-table.js +154 -0
- package/services/files/file-grant-table.js.map +1 -0
- package/services/files/file-identity.js +14 -0
- package/services/files/file-identity.js.map +1 -0
- package/services/files/file-presence.js +26 -0
- package/services/files/file-presence.js.map +1 -0
- package/services/files/file-renamer.js +35 -0
- package/services/files/file-renamer.js.map +1 -0
- package/services/files/folder-watch.js +117 -0
- package/services/files/folder-watch.js.map +1 -0
- package/services/files/grant-file-method.js +24 -0
- package/services/files/grant-file-method.js.map +1 -0
- package/services/files/module-files.js +68 -0
- package/services/files/module-files.js.map +1 -0
- package/services/files/resolve-file-share-method.js +23 -0
- package/services/files/resolve-file-share-method.js.map +1 -0
- package/services/installation/device-folder.js +24 -0
- package/services/installation/device-folder.js.map +1 -0
- package/services/installation/installation.js +207 -0
- package/services/installation/installation.js.map +1 -0
- package/services/installation/process-presence.js +45 -0
- package/services/installation/process-presence.js.map +1 -0
- package/services/lifetime/app-image-copy-cleanup.js +78 -0
- package/services/lifetime/app-image-copy-cleanup.js.map +1 -0
- package/services/lifetime/idle-monitor.js +47 -0
- package/services/lifetime/idle-monitor.js.map +1 -0
- package/services/lifetime/move-aside-method.js +18 -0
- package/services/lifetime/move-aside-method.js.map +1 -0
- package/services/lifetime/quit-answered-method.js +19 -0
- package/services/lifetime/quit-answered-method.js.map +1 -0
- package/services/lifetime/quit-method.js +17 -0
- package/services/lifetime/quit-method.js.map +1 -0
- package/services/lifetime/quit-relay.js +91 -0
- package/services/lifetime/quit-relay.js.map +1 -0
- package/services/lifetime/runtime-host.js +405 -0
- package/services/lifetime/runtime-host.js.map +1 -0
- package/services/lifetime/runtime-log.js +74 -0
- package/services/lifetime/runtime-log.js.map +1 -0
- package/services/lifetime/stop-method.js +39 -0
- package/services/lifetime/stop-method.js.map +1 -0
- package/services/lifetime/update-method.js +24 -0
- package/services/lifetime/update-method.js.map +1 -0
- package/services/lifetime/update-preparation.js +167 -0
- package/services/lifetime/update-preparation.js.map +1 -0
- package/services/lifetime/update-saved-method.js +19 -0
- package/services/lifetime/update-saved-method.js.map +1 -0
- package/services/modules/commands-method.js +17 -0
- package/services/modules/commands-method.js.map +1 -0
- package/services/modules/dependency-states.js +33 -0
- package/services/modules/dependency-states.js.map +1 -0
- package/services/modules/module-context.js +206 -0
- package/services/modules/module-context.js.map +1 -0
- package/services/modules/module-declaration.reader.js +46 -0
- package/services/modules/module-declaration.reader.js.map +1 -0
- package/services/modules/module-host.js +287 -0
- package/services/modules/module-host.js.map +1 -0
- package/services/modules/module-log.js +25 -0
- package/services/modules/module-log.js.map +1 -0
- package/services/modules/modules-method.js +17 -0
- package/services/modules/modules-method.js.map +1 -0
- package/services/modules/package-runtime-part-loader.js +33 -0
- package/services/modules/package-runtime-part-loader.js.map +1 -0
- package/services/modules/run-command-method.js +28 -0
- package/services/modules/run-command-method.js.map +1 -0
- package/services/native/native-addon.js +65 -0
- package/services/native/native-addon.js.map +1 -0
- package/services/notifications/clear-notifications-method.js +18 -0
- package/services/notifications/clear-notifications-method.js.map +1 -0
- package/services/notifications/dismiss-notification-method.js +19 -0
- package/services/notifications/dismiss-notification-method.js.map +1 -0
- package/services/notifications/mark-notifications-read-method.js +18 -0
- package/services/notifications/mark-notifications-read-method.js.map +1 -0
- package/services/notifications/notification-center.js +87 -0
- package/services/notifications/notification-center.js.map +1 -0
- package/services/notifications/notification-policy.js +54 -0
- package/services/notifications/notification-policy.js.map +1 -0
- package/services/notifications/notification-settings.js +32 -0
- package/services/notifications/notification-settings.js.map +1 -0
- package/services/notifications/notifications-method.js +21 -0
- package/services/notifications/notifications-method.js.map +1 -0
- package/services/notifications/post-notification-method.js +26 -0
- package/services/notifications/post-notification-method.js.map +1 -0
- package/services/ownership/ownership-lock.js +73 -0
- package/services/ownership/ownership-lock.js.map +1 -0
- package/services/permissions/module-permissions.js +36 -0
- package/services/permissions/module-permissions.js.map +1 -0
- package/services/permissions/permission-center.js +172 -0
- package/services/permissions/permission-center.js.map +1 -0
- package/services/permissions/permission-request-checker.js +146 -0
- package/services/permissions/permission-request-checker.js.map +1 -0
- package/services/permissions/remembered-permission-store.js +52 -0
- package/services/permissions/remembered-permission-store.js.map +1 -0
- package/services/process/batch-command-line.js +32 -0
- package/services/process/batch-command-line.js.map +1 -0
- package/services/process/child-process-starter.js +68 -0
- package/services/process/child-process-starter.js.map +1 -0
- package/services/process/foreground-process-group.reader.js +64 -0
- package/services/process/foreground-process-group.reader.js.map +1 -0
- package/services/process/linux-process-folder.js +55 -0
- package/services/process/linux-process-folder.js.map +1 -0
- package/services/process/posix-peer-process-api.js +95 -0
- package/services/process/posix-peer-process-api.js.map +1 -0
- package/services/process/posix-process-api.js +50 -0
- package/services/process/posix-process-api.js.map +1 -0
- package/services/process/posix-process-ender.js +199 -0
- package/services/process/posix-process-ender.js.map +1 -0
- package/services/process/posix-process-table.reader.js +24 -0
- package/services/process/posix-process-table.reader.js.map +1 -0
- package/services/process/posix-responsibility-api.js +38 -0
- package/services/process/posix-responsibility-api.js.map +1 -0
- package/services/process/process-clock.js +38 -0
- package/services/process/process-clock.js.map +1 -0
- package/services/process/process-ender-factory.js +22 -0
- package/services/process/process-ender-factory.js.map +1 -0
- package/services/process/process-environment.js +53 -0
- package/services/process/process-environment.js.map +1 -0
- package/services/process/process-record-store.js +35 -0
- package/services/process/process-record-store.js.map +1 -0
- package/services/process/process-signals.js +56 -0
- package/services/process/process-signals.js.map +1 -0
- package/services/process/process-supervisor.js +489 -0
- package/services/process/process-supervisor.js.map +1 -0
- package/services/process/program-launch-resolver.js +88 -0
- package/services/process/program-launch-resolver.js.map +1 -0
- package/services/process/program-locator.js +95 -0
- package/services/process/program-locator.js.map +1 -0
- package/services/process/programs-method.js +17 -0
- package/services/process/programs-method.js.map +1 -0
- package/services/process/windows-peer-process-api.js +52 -0
- package/services/process/windows-peer-process-api.js.map +1 -0
- package/services/process/windows-process-api.js +69 -0
- package/services/process/windows-process-api.js.map +1 -0
- package/services/process/windows-process-ender.js +137 -0
- package/services/process/windows-process-ender.js.map +1 -0
- package/services/process/windows-process-job.js +63 -0
- package/services/process/windows-process-job.js.map +1 -0
- package/services/process/windows-process-killer.js +58 -0
- package/services/process/windows-process-killer.js.map +1 -0
- package/services/process/windows-process-table.reader.js +46 -0
- package/services/process/windows-process-table.reader.js.map +1 -0
- package/services/recent-commands/recent-commands-method.js +18 -0
- package/services/recent-commands/recent-commands-method.js.map +1 -0
- package/services/recent-commands/recent-commands-store.js +29 -0
- package/services/recent-commands/recent-commands-store.js.map +1 -0
- package/services/recent-commands/record-command-method.js +21 -0
- package/services/recent-commands/record-command-method.js.map +1 -0
- package/services/registry/command-registry.js +51 -0
- package/services/registry/command-registry.js.map +1 -0
- package/services/registry/event-registry.js +34 -0
- package/services/registry/event-registry.js.map +1 -0
- package/services/registry/method-registry.js +26 -0
- package/services/registry/method-registry.js.map +1 -0
- package/services/registry/service-registry.js +26 -0
- package/services/registry/service-registry.js.map +1 -0
- package/services/runtime-entry.js +87 -0
- package/services/runtime-entry.js.map +1 -0
- package/services/secrets/machine-secret-backend.js +121 -0
- package/services/secrets/machine-secret-backend.js.map +1 -0
- package/services/secrets/module-secrets.js +37 -0
- package/services/secrets/module-secrets.js.map +1 -0
- package/services/secrets/remove-secret-method.js +19 -0
- package/services/secrets/remove-secret-method.js.map +1 -0
- package/services/secrets/save-secret-method.js +20 -0
- package/services/secrets/save-secret-method.js.map +1 -0
- package/services/secrets/secret-answered-method.js +19 -0
- package/services/secrets/secret-answered-method.js.map +1 -0
- package/services/secrets/secret-status-method.js +18 -0
- package/services/secrets/secret-status-method.js.map +1 -0
- package/services/secrets/secret-table.js +26 -0
- package/services/secrets/secret-table.js.map +1 -0
- package/services/settings/module-settings.js +69 -0
- package/services/settings/module-settings.js.map +1 -0
- package/services/settings/setting-read-method.js +18 -0
- package/services/settings/setting-read-method.js.map +1 -0
- package/services/settings/setting-reset-method.js +20 -0
- package/services/settings/setting-reset-method.js.map +1 -0
- package/services/settings/setting-write-method.js +20 -0
- package/services/settings/setting-write-method.js.map +1 -0
- package/services/settings/settings-read-method.js +18 -0
- package/services/settings/settings-read-method.js.map +1 -0
- package/services/settings/settings.service.js +162 -0
- package/services/settings/settings.service.js.map +1 -0
- package/services/settings/shell-settings.js +78 -0
- package/services/settings/shell-settings.js.map +1 -0
- package/services/tools/agent-control.js +49 -0
- package/services/tools/agent-control.js.map +1 -0
- package/services/tools/image-size.reader.js +35 -0
- package/services/tools/image-size.reader.js.map +1 -0
- package/services/tools/image-size.resources.js +24 -0
- package/services/tools/image-size.resources.js.map +1 -0
- package/services/tools/module-tools.js +77 -0
- package/services/tools/module-tools.js.map +1 -0
- package/services/tools/tool-endpoint.js +131 -0
- package/services/tools/tool-endpoint.js.map +1 -0
- package/services/tools/tool-registry.js +386 -0
- package/services/tools/tool-registry.js.map +1 -0
- package/services/tools/tool-result.validator.js +93 -0
- package/services/tools/tool-result.validator.js.map +1 -0
- package/services/tools/tool-schema.resources.js +45 -0
- package/services/tools/tool-schema.resources.js.map +1 -0
- package/services/tools/tool-schema.validator.js +232 -0
- package/services/tools/tool-schema.validator.js.map +1 -0
- package/services/web-views/module-web-view-relay.js +33 -0
- package/services/web-views/module-web-view-relay.js.map +1 -0
- package/services/web-views/module-web-views.js +46 -0
- package/services/web-views/module-web-views.js.map +1 -0
- package/services/web-views/web-view-answered-method.js +19 -0
- package/services/web-views/web-view-answered-method.js.map +1 -0
- package/services/web-views/web-view-center.js +119 -0
- package/services/web-views/web-view-center.js.map +1 -0
- package/services/web-views/web-view-events-method.js +19 -0
- package/services/web-views/web-view-events-method.js.map +1 -0
- package/services/window-state/window-state-read-method.js +20 -0
- package/services/window-state/window-state-read-method.js.map +1 -0
- package/services/window-state/window-state-store.js +24 -0
- package/services/window-state/window-state-store.js.map +1 -0
- package/services/window-state/window-state-write-method.js +22 -0
- package/services/window-state/window-state-write-method.js.map +1 -0
- package/services/work/work-method.js +17 -0
- package/services/work/work-method.js.map +1 -0
- package/services/work/work-tracker.js +56 -0
- package/services/work/work-tracker.js.map +1 -0
- package/testing/models/fake-app-shortcuts.js +18 -0
- package/testing/models/fake-app-shortcuts.js.map +1 -0
- package/testing/models/fake-app-windows.js +17 -0
- package/testing/models/fake-app-windows.js.map +1 -0
- package/testing/models/fake-module-database.js +17 -0
- package/testing/models/fake-module-database.js.map +1 -0
- package/testing/models/fake-module-log.js +12 -0
- package/testing/models/fake-module-log.js.map +1 -0
- package/testing/models/fake-module-secrets.js +15 -0
- package/testing/models/fake-module-secrets.js.map +1 -0
- package/testing/models/fake-module-settings.js +23 -0
- package/testing/models/fake-module-settings.js.map +1 -0
- package/testing/models/fake-permissions-context.js +28 -0
- package/testing/models/fake-permissions-context.js.map +1 -0
- package/testing/models/fake-runtime-files.js +13 -0
- package/testing/models/fake-runtime-files.js.map +1 -0
- package/testing/models/fake-runtime-part-context.js +70 -0
- package/testing/models/fake-runtime-part-context.js.map +1 -0
- package/testing/models/fake-runtime-web-views.js +26 -0
- package/testing/models/fake-runtime-web-views.js.map +1 -0
- package/testing/models/fake-tools-context.js +72 -0
- package/testing/models/fake-tools-context.js.map +1 -0
- package/testing/models/fake-web-view-relay.js +17 -0
- package/testing/models/fake-web-view-relay.js.map +1 -0
package/api/testing.d.ts
ADDED
|
@@ -0,0 +1,2128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { JsonObject, JsonValue } from "@noldova/context.json";
|
|
10
|
+
import type { SettingChange, WebViewEvent } from "@noldova/desktop.protocol";
|
|
11
|
+
import { Fake, type UnansweredCallException } from "@noldova/desktop.protocol/testing";
|
|
12
|
+
import type { ClientClosure, IAppShortcuts, IAppWindows, IModuleDatabase, IModuleLog, IModuleSecrets, IModuleSettings, IPermissionsContext, IRuntimeFiles,
|
|
13
|
+
IRuntimePartContext, IRuntimeWebViews, IToolsContext, IWebViewRelay, PermissionRevocation, Registration, RegistrationException,
|
|
14
|
+
WebViewProtocolEvent } from "@noldova/desktop.runtime";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A fake of the {@link IRuntimePartContext} that the runtime hands a module's
|
|
18
|
+
* runtime part, for the module's tests: it records every call, a test answers
|
|
19
|
+
* each member that returns a value with {@link Fake.answer}, its parts are
|
|
20
|
+
* fakes of their own, and its raisers call the listeners the module added, as
|
|
21
|
+
* the runtime would.
|
|
22
|
+
*
|
|
23
|
+
* A member that returns a value, or a property, throws
|
|
24
|
+
* {@link UnansweredCallException}, naming it, until the test answers it, so
|
|
25
|
+
* that no test passes on a value the fake made up.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* import { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
30
|
+
*
|
|
31
|
+
* export function startNotes(): FakeRuntimePartContext {
|
|
32
|
+
* const context = new FakeRuntimePartContext();
|
|
33
|
+
* context.answer("moduleId", "notes");
|
|
34
|
+
* context.settings.answer("read", () => "dark");
|
|
35
|
+
* return context;
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* export function registeredMethods(context: FakeRuntimePartContext): number {
|
|
39
|
+
* return context.callsOf("registerMethod").length;
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* import { UnansweredCallException } from "@noldova/desktop.protocol/testing";
|
|
46
|
+
* import { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
47
|
+
*
|
|
48
|
+
* export async function isUnansweredAsync(): Promise<boolean> {
|
|
49
|
+
* const fake = new FakeRuntimePartContext();
|
|
50
|
+
* try {
|
|
51
|
+
* await fake.getWorkFolderAsync();
|
|
52
|
+
* } catch (error) {
|
|
53
|
+
* return error instanceof UnansweredCallException;
|
|
54
|
+
* }
|
|
55
|
+
* return false;
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare class FakeRuntimePartContext extends Fake<IRuntimePartContext> implements IRuntimePartContext {
|
|
60
|
+
/**
|
|
61
|
+
* The fake that stands in for {@link IRuntimePartContext.database}, with
|
|
62
|
+
* calls and answers of its own.
|
|
63
|
+
*/
|
|
64
|
+
public readonly database: FakeModuleDatabase;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The fake that stands in for {@link IRuntimePartContext.settings}, with
|
|
68
|
+
* calls and answers of its own.
|
|
69
|
+
*/
|
|
70
|
+
public readonly settings: FakeModuleSettings;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The fake that stands in for {@link IRuntimePartContext.log}, with calls and
|
|
74
|
+
* answers of its own.
|
|
75
|
+
*/
|
|
76
|
+
public readonly log: FakeModuleLog;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The fake that stands in for {@link IRuntimePartContext.tools}, with calls
|
|
80
|
+
* and answers of its own.
|
|
81
|
+
*/
|
|
82
|
+
public readonly tools: FakeToolsContext;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The fake that stands in for {@link IRuntimePartContext.permissions}, with
|
|
86
|
+
* calls and answers of its own.
|
|
87
|
+
*/
|
|
88
|
+
public readonly permissions: FakePermissionsContext;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The fake that stands in for {@link IRuntimePartContext.webViews}, with
|
|
92
|
+
* calls and answers of its own.
|
|
93
|
+
*/
|
|
94
|
+
public readonly webViews: FakeRuntimeWebViews;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The fake that stands in for {@link IRuntimePartContext.files}, with calls
|
|
98
|
+
* and answers of its own.
|
|
99
|
+
*/
|
|
100
|
+
public readonly files: FakeRuntimeFiles;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The fake that stands in for {@link IRuntimePartContext.secrets}, with calls
|
|
104
|
+
* and answers of its own.
|
|
105
|
+
*/
|
|
106
|
+
public readonly secrets: FakeModuleSecrets;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The fake that stands in for {@link IRuntimePartContext.appWindows}, with
|
|
110
|
+
* calls and answers of its own.
|
|
111
|
+
*/
|
|
112
|
+
public readonly appWindows: FakeAppWindows;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The fake that stands in for {@link IRuntimePartContext.shortcuts}, with
|
|
116
|
+
* calls and answers of its own.
|
|
117
|
+
*/
|
|
118
|
+
public readonly shortcuts: FakeAppShortcuts;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Stands in for {@link IRuntimePartContext.getWorkFolderAsync}. Records each
|
|
122
|
+
* call, which {@link Fake.callsOf} reads, and returns what the answer that
|
|
123
|
+
* {@link Fake.answer} gives returns; while unanswered, the promise it returns
|
|
124
|
+
* rejects rather than the call throwing.
|
|
125
|
+
*
|
|
126
|
+
* @throws {UnansweredCallException} As the rejection of the promise it
|
|
127
|
+
* returns, naming the member, while the test has given it no answer, as the
|
|
128
|
+
* real member fails.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* import type { IRuntimePartContext } from "@noldova/desktop.runtime";
|
|
133
|
+
* import type { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
134
|
+
*
|
|
135
|
+
* export function answerGetWorkFolderAsync(fake: FakeRuntimePartContext, value: Awaited<ReturnType<IRuntimePartContext["getWorkFolderAsync"]>>): void {
|
|
136
|
+
* fake.answer("getWorkFolderAsync", () => Promise.resolve(value));
|
|
137
|
+
* }
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
public readonly getWorkFolderAsync: IRuntimePartContext["getWorkFolderAsync"];
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Stands in for {@link IRuntimePartContext.beginWork}. Records each call,
|
|
144
|
+
* which {@link Fake.callsOf} reads, and returns what the answer that
|
|
145
|
+
* {@link Fake.answer} gives returns.
|
|
146
|
+
*
|
|
147
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
148
|
+
* the test has given it no answer.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* import type { IRuntimePartContext } from "@noldova/desktop.runtime";
|
|
153
|
+
* import type { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
154
|
+
*
|
|
155
|
+
* export function answerBeginWork(fake: FakeRuntimePartContext, value: ReturnType<IRuntimePartContext["beginWork"]>): void {
|
|
156
|
+
* fake.answer("beginWork", () => value);
|
|
157
|
+
* }
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
public readonly beginWork: IRuntimePartContext["beginWork"];
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Stands in for {@link IRuntimePartContext.readEnvironmentAsync}. Records
|
|
164
|
+
* each call, which {@link Fake.callsOf} reads, and returns what the answer
|
|
165
|
+
* that {@link Fake.answer} gives returns; while unanswered, the promise it
|
|
166
|
+
* returns rejects rather than the call throwing.
|
|
167
|
+
*
|
|
168
|
+
* @throws {UnansweredCallException} As the rejection of the promise it
|
|
169
|
+
* returns, naming the member, while the test has given it no answer, as the
|
|
170
|
+
* real member fails.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```ts
|
|
174
|
+
* import type { IRuntimePartContext } from "@noldova/desktop.runtime";
|
|
175
|
+
* import type { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
176
|
+
*
|
|
177
|
+
* export function answerReadEnvironmentAsync(fake: FakeRuntimePartContext, value: Awaited<ReturnType<IRuntimePartContext["readEnvironmentAsync"]>>): void {
|
|
178
|
+
* fake.answer("readEnvironmentAsync", () => Promise.resolve(value));
|
|
179
|
+
* }
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
public readonly readEnvironmentAsync: IRuntimePartContext["readEnvironmentAsync"];
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Stands in for {@link IRuntimePartContext.startProcessAsync}. Records each
|
|
186
|
+
* call, which {@link Fake.callsOf} reads, and returns what the answer that
|
|
187
|
+
* {@link Fake.answer} gives returns; while unanswered, the promise it returns
|
|
188
|
+
* rejects rather than the call throwing.
|
|
189
|
+
*
|
|
190
|
+
* @throws {UnansweredCallException} As the rejection of the promise it
|
|
191
|
+
* returns, naming the member, while the test has given it no answer, as the
|
|
192
|
+
* real member fails.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```ts
|
|
196
|
+
* import type { IRuntimePartContext } from "@noldova/desktop.runtime";
|
|
197
|
+
* import type { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
198
|
+
*
|
|
199
|
+
* export function answerStartProcessAsync(fake: FakeRuntimePartContext, value: Awaited<ReturnType<IRuntimePartContext["startProcessAsync"]>>): void {
|
|
200
|
+
* fake.answer("startProcessAsync", () => Promise.resolve(value));
|
|
201
|
+
* }
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
public readonly startProcessAsync: IRuntimePartContext["startProcessAsync"];
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Stands in for {@link IRuntimePartContext.startPseudoTerminalAsync}. Records
|
|
208
|
+
* each call, which {@link Fake.callsOf} reads, and returns what the answer
|
|
209
|
+
* that {@link Fake.answer} gives returns; while unanswered, the promise it
|
|
210
|
+
* returns rejects rather than the call throwing.
|
|
211
|
+
*
|
|
212
|
+
* @throws {UnansweredCallException} As the rejection of the promise it
|
|
213
|
+
* returns, naming the member, while the test has given it no answer, as the
|
|
214
|
+
* real member fails.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```ts
|
|
218
|
+
* import type { IRuntimePartContext } from "@noldova/desktop.runtime";
|
|
219
|
+
* import type { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
220
|
+
*
|
|
221
|
+
* export function answerStartPseudoTerminalAsync(fake: FakeRuntimePartContext, value: Awaited<ReturnType<IRuntimePartContext["startPseudoTerminalAsync"]>>): void {
|
|
222
|
+
* fake.answer("startPseudoTerminalAsync", () => Promise.resolve(value));
|
|
223
|
+
* }
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
public readonly startPseudoTerminalAsync: IRuntimePartContext["startPseudoTerminalAsync"];
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Stands in for {@link IRuntimePartContext.registerMethod}. Records each
|
|
230
|
+
* call, which {@link Fake.callsOf} reads, and calls the answer that
|
|
231
|
+
* {@link Fake.answer} gives; while unanswered, it only records the call.
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```ts
|
|
235
|
+
* import type { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
236
|
+
*
|
|
237
|
+
* export function heardRegisterMethod(fake: FakeRuntimePartContext): readonly unknown[][] {
|
|
238
|
+
* const heard: unknown[][] = [];
|
|
239
|
+
* fake.answer("registerMethod", (...args) => {
|
|
240
|
+
* heard.push(args);
|
|
241
|
+
* });
|
|
242
|
+
* return heard;
|
|
243
|
+
* }
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
public readonly registerMethod: IRuntimePartContext["registerMethod"];
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Stands in for {@link IRuntimePartContext.declareEvent}. Records each call,
|
|
250
|
+
* which {@link Fake.callsOf} reads, and returns what the answer that
|
|
251
|
+
* {@link Fake.answer} gives returns.
|
|
252
|
+
*
|
|
253
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
254
|
+
* the test has given it no answer.
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```ts
|
|
258
|
+
* import type { IRuntimePartContext } from "@noldova/desktop.runtime";
|
|
259
|
+
* import type { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
260
|
+
*
|
|
261
|
+
* export function answerDeclareEvent(fake: FakeRuntimePartContext, value: ReturnType<IRuntimePartContext["declareEvent"]>): void {
|
|
262
|
+
* fake.answer("declareEvent", () => value);
|
|
263
|
+
* }
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
public readonly declareEvent: IRuntimePartContext["declareEvent"];
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Stands in for {@link IRuntimePartContext.registerCommand}. Records each
|
|
270
|
+
* call, which {@link Fake.callsOf} reads, and calls the answer that
|
|
271
|
+
* {@link Fake.answer} gives; while unanswered, it only records the call.
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* ```ts
|
|
275
|
+
* import type { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
276
|
+
*
|
|
277
|
+
* export function heardRegisterCommand(fake: FakeRuntimePartContext): readonly unknown[][] {
|
|
278
|
+
* const heard: unknown[][] = [];
|
|
279
|
+
* fake.answer("registerCommand", (...args) => {
|
|
280
|
+
* heard.push(args);
|
|
281
|
+
* });
|
|
282
|
+
* return heard;
|
|
283
|
+
* }
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
public readonly registerCommand: IRuntimePartContext["registerCommand"];
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Stands in for {@link IRuntimePartContext.onClientClosed}. Records each
|
|
290
|
+
* listener, which {@link FakeRuntimePartContext.raiseClientClosedAsync} calls
|
|
291
|
+
* and {@link Fake.activeCallsOf} lists; like the interface, it gives no way
|
|
292
|
+
* to remove it, and it takes no answer.
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```ts
|
|
296
|
+
* import type { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
297
|
+
*
|
|
298
|
+
* export function activeOnClientClosed(fake: FakeRuntimePartContext): number {
|
|
299
|
+
* return fake.activeCallsOf("onClientClosed").length;
|
|
300
|
+
* }
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
public readonly onClientClosed: IRuntimePartContext["onClientClosed"];
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Stands in for {@link IRuntimePartContext.postNotification}. Records each
|
|
307
|
+
* call, which {@link Fake.callsOf} reads, and returns what the answer that
|
|
308
|
+
* {@link Fake.answer} gives returns.
|
|
309
|
+
*
|
|
310
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
311
|
+
* the test has given it no answer.
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* ```ts
|
|
315
|
+
* import type { IRuntimePartContext } from "@noldova/desktop.runtime";
|
|
316
|
+
* import type { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
317
|
+
*
|
|
318
|
+
* export function answerPostNotification(fake: FakeRuntimePartContext, value: ReturnType<IRuntimePartContext["postNotification"]>): void {
|
|
319
|
+
* fake.answer("postNotification", () => value);
|
|
320
|
+
* }
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
public readonly postNotification: IRuntimePartContext["postNotification"];
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Stands in for {@link IRuntimePartContext.publishService}. Records each
|
|
327
|
+
* call, which {@link Fake.callsOf} reads, and calls the answer that
|
|
328
|
+
* {@link Fake.answer} gives; while unanswered, it only records the call.
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* ```ts
|
|
332
|
+
* import type { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
333
|
+
*
|
|
334
|
+
* export function heardPublishService(fake: FakeRuntimePartContext): readonly unknown[][] {
|
|
335
|
+
* const heard: unknown[][] = [];
|
|
336
|
+
* fake.answer("publishService", (...args) => {
|
|
337
|
+
* heard.push(args);
|
|
338
|
+
* });
|
|
339
|
+
* return heard;
|
|
340
|
+
* }
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
public readonly publishService: IRuntimePartContext["publishService"];
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Stands in for {@link IRuntimePartContext.onDependencyChanged}. Records each
|
|
347
|
+
* listener, which {@link FakeRuntimePartContext.raiseDependencyChanged} calls
|
|
348
|
+
* and {@link Fake.activeCallsOf} lists until the disposer it returns runs; it
|
|
349
|
+
* takes no answer.
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* ```ts
|
|
353
|
+
* import type { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
354
|
+
*
|
|
355
|
+
* export function activeOnDependencyChanged(fake: FakeRuntimePartContext): number {
|
|
356
|
+
* return fake.activeCallsOf("onDependencyChanged").length;
|
|
357
|
+
* }
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
public readonly onDependencyChanged: IRuntimePartContext["onDependencyChanged"];
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Stands in for {@link IRuntimePartContext.moduleId}. Reads the value that
|
|
364
|
+
* {@link Fake.answer} gives.
|
|
365
|
+
*
|
|
366
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
367
|
+
* the test has given it no answer.
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
* ```ts
|
|
371
|
+
* import type { IRuntimePartContext } from "@noldova/desktop.runtime";
|
|
372
|
+
* import type { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
373
|
+
*
|
|
374
|
+
* export function answerModuleId(fake: FakeRuntimePartContext, value: IRuntimePartContext["moduleId"]): void {
|
|
375
|
+
* fake.answer("moduleId", value);
|
|
376
|
+
* }
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
379
|
+
public get moduleId(): string;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Stands in for {@link IRuntimePartContext.moduleFolder}. Reads the value
|
|
383
|
+
* that {@link Fake.answer} gives.
|
|
384
|
+
*
|
|
385
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
386
|
+
* the test has given it no answer.
|
|
387
|
+
*
|
|
388
|
+
* @example
|
|
389
|
+
* ```ts
|
|
390
|
+
* import type { IRuntimePartContext } from "@noldova/desktop.runtime";
|
|
391
|
+
* import type { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
392
|
+
*
|
|
393
|
+
* export function answerModuleFolder(fake: FakeRuntimePartContext, value: IRuntimePartContext["moduleFolder"]): void {
|
|
394
|
+
* fake.answer("moduleFolder", value);
|
|
395
|
+
* }
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
398
|
+
public get moduleFolder(): string;
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Stands in for {@link IRuntimePartContext.getService}. Records each call,
|
|
402
|
+
* which {@link Fake.callsOf} reads, and returns what the answer that
|
|
403
|
+
* {@link Fake.answer} gives returns.
|
|
404
|
+
*
|
|
405
|
+
* @typeParam T The service's type.
|
|
406
|
+
*
|
|
407
|
+
* @param name The service's name.
|
|
408
|
+
*
|
|
409
|
+
* @param type The class the service is an instance of.
|
|
410
|
+
*
|
|
411
|
+
* @returns What the answer returns.
|
|
412
|
+
*
|
|
413
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
414
|
+
* the test has given it no answer.
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* ```ts
|
|
418
|
+
* import type { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
419
|
+
*
|
|
420
|
+
* export function answerGetService(fake: FakeRuntimePartContext): void {
|
|
421
|
+
* fake.answer("getService", name => {
|
|
422
|
+
* throw new Error(`No ${name} service.`);
|
|
423
|
+
* });
|
|
424
|
+
* }
|
|
425
|
+
* ```
|
|
426
|
+
*/
|
|
427
|
+
public getService<T extends object>(name: string, type: abstract new (...args: never[]) => T): T;
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Stands in for {@link IRuntimePartContext.findService}. Records each call,
|
|
431
|
+
* which {@link Fake.callsOf} reads, and returns what the answer that
|
|
432
|
+
* {@link Fake.answer} gives returns.
|
|
433
|
+
*
|
|
434
|
+
* @typeParam T The service's type.
|
|
435
|
+
*
|
|
436
|
+
* @param name The service's name.
|
|
437
|
+
*
|
|
438
|
+
* @param guard Tells whether a service is of the type.
|
|
439
|
+
*
|
|
440
|
+
* @returns What the answer returns.
|
|
441
|
+
*
|
|
442
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
443
|
+
* the test has given it no answer.
|
|
444
|
+
*
|
|
445
|
+
* @example
|
|
446
|
+
* ```ts
|
|
447
|
+
* import type { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
448
|
+
*
|
|
449
|
+
* export function answerFindService(fake: FakeRuntimePartContext): void {
|
|
450
|
+
* fake.answer("findService", () => null);
|
|
451
|
+
* }
|
|
452
|
+
* ```
|
|
453
|
+
*/
|
|
454
|
+
public findService<T extends object>(name: string, guard: (service: object) => service is T): T | null;
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Tells each listener of {@link IRuntimePartContext.onClientClosed} that a
|
|
458
|
+
* client closed, and waits for what each one returns, which the runtime
|
|
459
|
+
* itself doesn't.
|
|
460
|
+
*
|
|
461
|
+
* As the runtime's own dispatch does, it skips a listener that an earlier one
|
|
462
|
+
* removes during the call, and one that throws or rejects stops no other:
|
|
463
|
+
* {@link Fake.errors} keeps what it threw, where the runtime's diagnostics
|
|
464
|
+
* log it.
|
|
465
|
+
*
|
|
466
|
+
* @param closure The client that closed.
|
|
467
|
+
*
|
|
468
|
+
* @returns A promise that settles when every listener's work has.
|
|
469
|
+
*
|
|
470
|
+
* @example
|
|
471
|
+
* ```ts
|
|
472
|
+
* import { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
473
|
+
*
|
|
474
|
+
* import { ClientClosure } from "@noldova/desktop.runtime";
|
|
475
|
+
*
|
|
476
|
+
* export async function closeWindow(context: FakeRuntimePartContext): Promise<void> {
|
|
477
|
+
* await context.raiseClientClosedAsync(new ClientClosure(1, 1));
|
|
478
|
+
* }
|
|
479
|
+
* ```
|
|
480
|
+
*/
|
|
481
|
+
public raiseClientClosedAsync(closure: ClientClosure): Promise<void>;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Tells each listener of {@link IRuntimePartContext.onDependencyChanged} that
|
|
485
|
+
* an optional dependency became active or stopped.
|
|
486
|
+
*
|
|
487
|
+
* As Noldova Desktop's own dispatch does, it skips a listener that an earlier
|
|
488
|
+
* one removes during the call, and one that throws stops no other: the fake's
|
|
489
|
+
* {@link FakeRuntimePartContext.log} records the line the module's log would
|
|
490
|
+
* write.
|
|
491
|
+
*
|
|
492
|
+
* @param moduleId The dependency's id.
|
|
493
|
+
*
|
|
494
|
+
* @param isActive Whether it is active now.
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* ```ts
|
|
498
|
+
* import { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
499
|
+
*
|
|
500
|
+
* export function stopGit(context: FakeRuntimePartContext): void {
|
|
501
|
+
* context.raiseDependencyChanged("git", false);
|
|
502
|
+
* }
|
|
503
|
+
* ```
|
|
504
|
+
*/
|
|
505
|
+
public raiseDependencyChanged(moduleId: string, isActive: boolean): void;
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* The fakes it holds, its database, settings, log, tools, permissions,
|
|
509
|
+
* web views, files, secrets, app windows and shortcuts, which
|
|
510
|
+
* {@link Fake.beStrict} makes strict with it.
|
|
511
|
+
*
|
|
512
|
+
* @returns The fakes it holds.
|
|
513
|
+
*
|
|
514
|
+
* @example
|
|
515
|
+
* ```ts
|
|
516
|
+
* import { FakeRuntimePartContext } from "@noldova/desktop.runtime/testing";
|
|
517
|
+
*
|
|
518
|
+
* export function strict(): FakeRuntimePartContext {
|
|
519
|
+
* const fake = new FakeRuntimePartContext();
|
|
520
|
+
* fake.beStrict();
|
|
521
|
+
* return fake;
|
|
522
|
+
* }
|
|
523
|
+
* ```
|
|
524
|
+
*/
|
|
525
|
+
protected override parts(): readonly Pick<Fake<object>, "beStrict">[];
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* A fake of {@link IRuntimePartContext.database}, the module's database, for a
|
|
530
|
+
* module's tests: it records every call, and a test answers each member that
|
|
531
|
+
* returns a value with {@link Fake.answer}.
|
|
532
|
+
*
|
|
533
|
+
* A member that returns a value, or a property, throws
|
|
534
|
+
* {@link UnansweredCallException}, naming it, until the test answers it, so
|
|
535
|
+
* that no test passes on a value the fake made up.
|
|
536
|
+
*
|
|
537
|
+
* @example
|
|
538
|
+
* ```ts
|
|
539
|
+
* import { FakeModuleDatabase } from "@noldova/desktop.runtime/testing";
|
|
540
|
+
*
|
|
541
|
+
* export function withNoRows(): FakeModuleDatabase {
|
|
542
|
+
* const database = new FakeModuleDatabase();
|
|
543
|
+
* database.answer("readAll", () => []);
|
|
544
|
+
* return database;
|
|
545
|
+
* }
|
|
546
|
+
* ```
|
|
547
|
+
*
|
|
548
|
+
* @example
|
|
549
|
+
* ```ts
|
|
550
|
+
* import { UnansweredCallException } from "@noldova/desktop.protocol/testing";
|
|
551
|
+
* import { FakeModuleDatabase } from "@noldova/desktop.runtime/testing";
|
|
552
|
+
*
|
|
553
|
+
* export function isUnanswered(): boolean {
|
|
554
|
+
* const fake = new FakeModuleDatabase();
|
|
555
|
+
* try {
|
|
556
|
+
* fake.readAll("SELECT name FROM notes");
|
|
557
|
+
* } catch (error) {
|
|
558
|
+
* return error instanceof UnansweredCallException;
|
|
559
|
+
* }
|
|
560
|
+
* return false;
|
|
561
|
+
* }
|
|
562
|
+
* ```
|
|
563
|
+
*/
|
|
564
|
+
export declare class FakeModuleDatabase extends Fake<IModuleDatabase> implements IModuleDatabase {
|
|
565
|
+
/**
|
|
566
|
+
* Stands in for {@link IModuleDatabase.read}. Records each call, which
|
|
567
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
568
|
+
* {@link Fake.answer} gives returns.
|
|
569
|
+
*
|
|
570
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
571
|
+
* the test has given it no answer.
|
|
572
|
+
*
|
|
573
|
+
* @example
|
|
574
|
+
* ```ts
|
|
575
|
+
* import type { IModuleDatabase } from "@noldova/desktop.runtime";
|
|
576
|
+
* import type { FakeModuleDatabase } from "@noldova/desktop.runtime/testing";
|
|
577
|
+
*
|
|
578
|
+
* export function answerRead(fake: FakeModuleDatabase, value: ReturnType<IModuleDatabase["read"]>): void {
|
|
579
|
+
* fake.answer("read", () => value);
|
|
580
|
+
* }
|
|
581
|
+
* ```
|
|
582
|
+
*/
|
|
583
|
+
public readonly read: IModuleDatabase["read"];
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Stands in for {@link IModuleDatabase.readAll}. Records each call, which
|
|
587
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
588
|
+
* {@link Fake.answer} gives returns.
|
|
589
|
+
*
|
|
590
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
591
|
+
* the test has given it no answer.
|
|
592
|
+
*
|
|
593
|
+
* @example
|
|
594
|
+
* ```ts
|
|
595
|
+
* import type { IModuleDatabase } from "@noldova/desktop.runtime";
|
|
596
|
+
* import type { FakeModuleDatabase } from "@noldova/desktop.runtime/testing";
|
|
597
|
+
*
|
|
598
|
+
* export function answerReadAll(fake: FakeModuleDatabase, value: ReturnType<IModuleDatabase["readAll"]>): void {
|
|
599
|
+
* fake.answer("readAll", () => value);
|
|
600
|
+
* }
|
|
601
|
+
* ```
|
|
602
|
+
*/
|
|
603
|
+
public readonly readAll: IModuleDatabase["readAll"];
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Stands in for {@link IModuleDatabase.run}. Records each call, which
|
|
607
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
608
|
+
* {@link Fake.answer} gives returns.
|
|
609
|
+
*
|
|
610
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
611
|
+
* the test has given it no answer.
|
|
612
|
+
*
|
|
613
|
+
* @example
|
|
614
|
+
* ```ts
|
|
615
|
+
* import type { IModuleDatabase } from "@noldova/desktop.runtime";
|
|
616
|
+
* import type { FakeModuleDatabase } from "@noldova/desktop.runtime/testing";
|
|
617
|
+
*
|
|
618
|
+
* export function answerRun(fake: FakeModuleDatabase, value: ReturnType<IModuleDatabase["run"]>): void {
|
|
619
|
+
* fake.answer("run", () => value);
|
|
620
|
+
* }
|
|
621
|
+
* ```
|
|
622
|
+
*/
|
|
623
|
+
public readonly run: IModuleDatabase["run"];
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Stands in for {@link IModuleDatabase.transaction}. Records each call, which
|
|
627
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
628
|
+
* {@link Fake.answer} gives returns.
|
|
629
|
+
*
|
|
630
|
+
* @typeParam T What the action returns.
|
|
631
|
+
*
|
|
632
|
+
* @param action What runs in the transaction.
|
|
633
|
+
*
|
|
634
|
+
* @returns What the answer returns.
|
|
635
|
+
*
|
|
636
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
637
|
+
* the test has given it no answer.
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
* ```ts
|
|
641
|
+
* import type { FakeModuleDatabase } from "@noldova/desktop.runtime/testing";
|
|
642
|
+
*
|
|
643
|
+
* export function answerTransaction(fake: FakeModuleDatabase): void {
|
|
644
|
+
* fake.answer("transaction", action => action());
|
|
645
|
+
* }
|
|
646
|
+
* ```
|
|
647
|
+
*/
|
|
648
|
+
public transaction<T>(action: () => T & ([T] extends [PromiseLike<unknown>] ? never : unknown)): T;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* A fake of {@link IRuntimePartContext.settings}, the module's settings, for a
|
|
653
|
+
* module's tests: it records every call, and a test answers each member that
|
|
654
|
+
* returns a value with {@link Fake.answer}.
|
|
655
|
+
*
|
|
656
|
+
* A member that returns a value, or a property, throws
|
|
657
|
+
* {@link UnansweredCallException}, naming it, until the test answers it, so
|
|
658
|
+
* that no test passes on a value the fake made up.
|
|
659
|
+
*
|
|
660
|
+
* @example
|
|
661
|
+
* ```ts
|
|
662
|
+
* import { FakeModuleSettings } from "@noldova/desktop.runtime/testing";
|
|
663
|
+
*
|
|
664
|
+
* export function withDark(): FakeModuleSettings {
|
|
665
|
+
* const settings = new FakeModuleSettings();
|
|
666
|
+
* settings.answer("read", () => "dark");
|
|
667
|
+
* return settings;
|
|
668
|
+
* }
|
|
669
|
+
* ```
|
|
670
|
+
*
|
|
671
|
+
* @example
|
|
672
|
+
* ```ts
|
|
673
|
+
* import { UnansweredCallException } from "@noldova/desktop.protocol/testing";
|
|
674
|
+
* import { FakeModuleSettings } from "@noldova/desktop.runtime/testing";
|
|
675
|
+
*
|
|
676
|
+
* export function isUnanswered(): boolean {
|
|
677
|
+
* const fake = new FakeModuleSettings();
|
|
678
|
+
* try {
|
|
679
|
+
* fake.read("notes.theme");
|
|
680
|
+
* } catch (error) {
|
|
681
|
+
* return error instanceof UnansweredCallException;
|
|
682
|
+
* }
|
|
683
|
+
* return false;
|
|
684
|
+
* }
|
|
685
|
+
* ```
|
|
686
|
+
*/
|
|
687
|
+
export declare class FakeModuleSettings extends Fake<IModuleSettings> implements IModuleSettings {
|
|
688
|
+
/**
|
|
689
|
+
* Stands in for {@link IModuleSettings.read}. Records each call, which
|
|
690
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
691
|
+
* {@link Fake.answer} gives returns.
|
|
692
|
+
*
|
|
693
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
694
|
+
* the test has given it no answer.
|
|
695
|
+
*
|
|
696
|
+
* @example
|
|
697
|
+
* ```ts
|
|
698
|
+
* import type { IModuleSettings } from "@noldova/desktop.runtime";
|
|
699
|
+
* import type { FakeModuleSettings } from "@noldova/desktop.runtime/testing";
|
|
700
|
+
*
|
|
701
|
+
* export function answerRead(fake: FakeModuleSettings, value: ReturnType<IModuleSettings["read"]>): void {
|
|
702
|
+
* fake.answer("read", () => value);
|
|
703
|
+
* }
|
|
704
|
+
* ```
|
|
705
|
+
*/
|
|
706
|
+
public readonly read: IModuleSettings["read"];
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* Stands in for {@link IModuleSettings.write}. Records each call, which
|
|
710
|
+
* {@link Fake.callsOf} reads, and calls the answer that {@link Fake.answer}
|
|
711
|
+
* gives; while unanswered, it only records the call.
|
|
712
|
+
*
|
|
713
|
+
* @example
|
|
714
|
+
* ```ts
|
|
715
|
+
* import type { FakeModuleSettings } from "@noldova/desktop.runtime/testing";
|
|
716
|
+
*
|
|
717
|
+
* export function heardWrite(fake: FakeModuleSettings): readonly unknown[][] {
|
|
718
|
+
* const heard: unknown[][] = [];
|
|
719
|
+
* fake.answer("write", (...args) => {
|
|
720
|
+
* heard.push(args);
|
|
721
|
+
* });
|
|
722
|
+
* return heard;
|
|
723
|
+
* }
|
|
724
|
+
* ```
|
|
725
|
+
*/
|
|
726
|
+
public readonly write: IModuleSettings["write"];
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Stands in for {@link IModuleSettings.reset}. Records each call, which
|
|
730
|
+
* {@link Fake.callsOf} reads, and calls the answer that {@link Fake.answer}
|
|
731
|
+
* gives; while unanswered, it only records the call.
|
|
732
|
+
*
|
|
733
|
+
* @example
|
|
734
|
+
* ```ts
|
|
735
|
+
* import type { FakeModuleSettings } from "@noldova/desktop.runtime/testing";
|
|
736
|
+
*
|
|
737
|
+
* export function heardReset(fake: FakeModuleSettings): readonly unknown[][] {
|
|
738
|
+
* const heard: unknown[][] = [];
|
|
739
|
+
* fake.answer("reset", (...args) => {
|
|
740
|
+
* heard.push(args);
|
|
741
|
+
* });
|
|
742
|
+
* return heard;
|
|
743
|
+
* }
|
|
744
|
+
* ```
|
|
745
|
+
*/
|
|
746
|
+
public readonly reset: IModuleSettings["reset"];
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* Stands in for {@link IModuleSettings.onChanged}. Records each listener,
|
|
750
|
+
* which {@link FakeModuleSettings.raiseChanged} calls and
|
|
751
|
+
* {@link Fake.activeCallsOf} lists; like the interface, it gives no way to
|
|
752
|
+
* remove it, and it takes no answer.
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* ```ts
|
|
756
|
+
* import type { FakeModuleSettings } from "@noldova/desktop.runtime/testing";
|
|
757
|
+
*
|
|
758
|
+
* export function activeOnChanged(fake: FakeModuleSettings): number {
|
|
759
|
+
* return fake.activeCallsOf("onChanged").length;
|
|
760
|
+
* }
|
|
761
|
+
* ```
|
|
762
|
+
*/
|
|
763
|
+
public readonly onChanged: IModuleSettings["onChanged"];
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Stands in for {@link IModuleSettings.setScopeParent}. Records each call,
|
|
767
|
+
* which {@link Fake.callsOf} reads, and calls the answer that
|
|
768
|
+
* {@link Fake.answer} gives; while unanswered, it only records the call.
|
|
769
|
+
*
|
|
770
|
+
* @example
|
|
771
|
+
* ```ts
|
|
772
|
+
* import type { FakeModuleSettings } from "@noldova/desktop.runtime/testing";
|
|
773
|
+
*
|
|
774
|
+
* export function heardSetScopeParent(fake: FakeModuleSettings): readonly unknown[][] {
|
|
775
|
+
* const heard: unknown[][] = [];
|
|
776
|
+
* fake.answer("setScopeParent", (...args) => {
|
|
777
|
+
* heard.push(args);
|
|
778
|
+
* });
|
|
779
|
+
* return heard;
|
|
780
|
+
* }
|
|
781
|
+
* ```
|
|
782
|
+
*/
|
|
783
|
+
public readonly setScopeParent: IModuleSettings["setScopeParent"];
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Stands in for {@link IModuleSettings.removeScope}. Records each call, which
|
|
787
|
+
* {@link Fake.callsOf} reads, and calls the answer that {@link Fake.answer}
|
|
788
|
+
* gives; while unanswered, it only records the call.
|
|
789
|
+
*
|
|
790
|
+
* @example
|
|
791
|
+
* ```ts
|
|
792
|
+
* import type { FakeModuleSettings } from "@noldova/desktop.runtime/testing";
|
|
793
|
+
*
|
|
794
|
+
* export function heardRemoveScope(fake: FakeModuleSettings): readonly unknown[][] {
|
|
795
|
+
* const heard: unknown[][] = [];
|
|
796
|
+
* fake.answer("removeScope", (...args) => {
|
|
797
|
+
* heard.push(args);
|
|
798
|
+
* });
|
|
799
|
+
* return heard;
|
|
800
|
+
* }
|
|
801
|
+
* ```
|
|
802
|
+
*/
|
|
803
|
+
public readonly removeScope: IModuleSettings["removeScope"];
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Tells each listener of {@link IModuleSettings.onChanged} for the setting
|
|
807
|
+
* that its value changed.
|
|
808
|
+
*
|
|
809
|
+
* As Noldova Desktop's own dispatch does, it calls each listener in place when
|
|
810
|
+
* the call starts: one that an earlier one removes during the call is still
|
|
811
|
+
* called, and one that throws stops the rest, and its error comes out of this
|
|
812
|
+
* call.
|
|
813
|
+
*
|
|
814
|
+
* @param name The setting's name.
|
|
815
|
+
*
|
|
816
|
+
* @param change The change.
|
|
817
|
+
*
|
|
818
|
+
* @example
|
|
819
|
+
* ```ts
|
|
820
|
+
* import { FakeModuleSettings } from "@noldova/desktop.runtime/testing";
|
|
821
|
+
*
|
|
822
|
+
* import type { SettingChange } from "@noldova/desktop.protocol";
|
|
823
|
+
*
|
|
824
|
+
* export function change(settings: FakeModuleSettings, value: SettingChange): void {
|
|
825
|
+
* settings.raiseChanged("terminal.theme", value);
|
|
826
|
+
* }
|
|
827
|
+
* ```
|
|
828
|
+
*/
|
|
829
|
+
public raiseChanged(name: string, change: SettingChange): void;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* A fake of {@link IRuntimePartContext.log}, the module's log, for a module's
|
|
834
|
+
* tests: it records every call, and a test answers each member that returns a
|
|
835
|
+
* value with {@link Fake.answer}.
|
|
836
|
+
*
|
|
837
|
+
* A member that returns a value, or a property, throws
|
|
838
|
+
* {@link UnansweredCallException}, naming it, until the test answers it, so
|
|
839
|
+
* that no test passes on a value the fake made up.
|
|
840
|
+
*
|
|
841
|
+
* @example
|
|
842
|
+
* ```ts
|
|
843
|
+
* import { FakeModuleLog } from "@noldova/desktop.runtime/testing";
|
|
844
|
+
*
|
|
845
|
+
* export function written(log: FakeModuleLog): readonly string[] {
|
|
846
|
+
* return log.callsOf("write").map(t => String(t[0]));
|
|
847
|
+
* }
|
|
848
|
+
* ```
|
|
849
|
+
*/
|
|
850
|
+
export declare class FakeModuleLog extends Fake<IModuleLog> implements IModuleLog {
|
|
851
|
+
/**
|
|
852
|
+
* Stands in for {@link IModuleLog.write}. Records each call, which
|
|
853
|
+
* {@link Fake.callsOf} reads, and calls the answer that {@link Fake.answer}
|
|
854
|
+
* gives; while unanswered, it only records the call.
|
|
855
|
+
*
|
|
856
|
+
* @example
|
|
857
|
+
* ```ts
|
|
858
|
+
* import type { FakeModuleLog } from "@noldova/desktop.runtime/testing";
|
|
859
|
+
*
|
|
860
|
+
* export function heardWrite(fake: FakeModuleLog): readonly unknown[][] {
|
|
861
|
+
* const heard: unknown[][] = [];
|
|
862
|
+
* fake.answer("write", (...args) => {
|
|
863
|
+
* heard.push(args);
|
|
864
|
+
* });
|
|
865
|
+
* return heard;
|
|
866
|
+
* }
|
|
867
|
+
* ```
|
|
868
|
+
*/
|
|
869
|
+
public readonly write: IModuleLog["write"];
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* A fake of {@link IRuntimePartContext.secrets}, the module's secrets, for a
|
|
874
|
+
* module's tests: it records every call, and a test answers each member that
|
|
875
|
+
* returns a value with {@link Fake.answer}.
|
|
876
|
+
*
|
|
877
|
+
* A member that returns a value, or a property, throws
|
|
878
|
+
* {@link UnansweredCallException}, naming it, until the test answers it, so
|
|
879
|
+
* that no test passes on a value the fake made up.
|
|
880
|
+
*
|
|
881
|
+
* @example
|
|
882
|
+
* ```ts
|
|
883
|
+
* import { FakeModuleSecrets } from "@noldova/desktop.runtime/testing";
|
|
884
|
+
*
|
|
885
|
+
* export function withNone(): FakeModuleSecrets {
|
|
886
|
+
* const secrets = new FakeModuleSecrets();
|
|
887
|
+
* secrets.answer("readAsync", () => Promise.resolve(null));
|
|
888
|
+
* return secrets;
|
|
889
|
+
* }
|
|
890
|
+
* ```
|
|
891
|
+
*
|
|
892
|
+
* @example
|
|
893
|
+
* ```ts
|
|
894
|
+
* import { UnansweredCallException } from "@noldova/desktop.protocol/testing";
|
|
895
|
+
* import { FakeModuleSecrets } from "@noldova/desktop.runtime/testing";
|
|
896
|
+
*
|
|
897
|
+
* export async function isUnansweredAsync(): Promise<boolean> {
|
|
898
|
+
* const fake = new FakeModuleSecrets();
|
|
899
|
+
* try {
|
|
900
|
+
* await fake.readAsync("notes.token");
|
|
901
|
+
* } catch (error) {
|
|
902
|
+
* return error instanceof UnansweredCallException;
|
|
903
|
+
* }
|
|
904
|
+
* return false;
|
|
905
|
+
* }
|
|
906
|
+
* ```
|
|
907
|
+
*/
|
|
908
|
+
export declare class FakeModuleSecrets extends Fake<IModuleSecrets> implements IModuleSecrets {
|
|
909
|
+
/**
|
|
910
|
+
* Stands in for {@link IModuleSecrets.saveAsync}. Records each call, which
|
|
911
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
912
|
+
* {@link Fake.answer} gives returns; while unanswered, the promise it returns
|
|
913
|
+
* rejects rather than the call throwing.
|
|
914
|
+
*
|
|
915
|
+
* @throws {UnansweredCallException} As the rejection of the promise it
|
|
916
|
+
* returns, naming the member, while the test has given it no answer, as the
|
|
917
|
+
* real member fails.
|
|
918
|
+
*
|
|
919
|
+
* @example
|
|
920
|
+
* ```ts
|
|
921
|
+
* import type { IModuleSecrets } from "@noldova/desktop.runtime";
|
|
922
|
+
* import type { FakeModuleSecrets } from "@noldova/desktop.runtime/testing";
|
|
923
|
+
*
|
|
924
|
+
* export function answerSaveAsync(fake: FakeModuleSecrets, value: Awaited<ReturnType<IModuleSecrets["saveAsync"]>>): void {
|
|
925
|
+
* fake.answer("saveAsync", () => Promise.resolve(value));
|
|
926
|
+
* }
|
|
927
|
+
* ```
|
|
928
|
+
*/
|
|
929
|
+
public readonly saveAsync: IModuleSecrets["saveAsync"];
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* Stands in for {@link IModuleSecrets.readAsync}. Records each call, which
|
|
933
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
934
|
+
* {@link Fake.answer} gives returns; while unanswered, the promise it returns
|
|
935
|
+
* rejects rather than the call throwing.
|
|
936
|
+
*
|
|
937
|
+
* @throws {UnansweredCallException} As the rejection of the promise it
|
|
938
|
+
* returns, naming the member, while the test has given it no answer, as the
|
|
939
|
+
* real member fails.
|
|
940
|
+
*
|
|
941
|
+
* @example
|
|
942
|
+
* ```ts
|
|
943
|
+
* import type { IModuleSecrets } from "@noldova/desktop.runtime";
|
|
944
|
+
* import type { FakeModuleSecrets } from "@noldova/desktop.runtime/testing";
|
|
945
|
+
*
|
|
946
|
+
* export function answerReadAsync(fake: FakeModuleSecrets, value: Awaited<ReturnType<IModuleSecrets["readAsync"]>>): void {
|
|
947
|
+
* fake.answer("readAsync", () => Promise.resolve(value));
|
|
948
|
+
* }
|
|
949
|
+
* ```
|
|
950
|
+
*/
|
|
951
|
+
public readonly readAsync: IModuleSecrets["readAsync"];
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* Stands in for {@link IModuleSecrets.removeAsync}. Records each call, which
|
|
955
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
956
|
+
* {@link Fake.answer} gives returns; while unanswered, the promise it returns
|
|
957
|
+
* rejects rather than the call throwing.
|
|
958
|
+
*
|
|
959
|
+
* @throws {UnansweredCallException} As the rejection of the promise it
|
|
960
|
+
* returns, naming the member, while the test has given it no answer, as the
|
|
961
|
+
* real member fails.
|
|
962
|
+
*
|
|
963
|
+
* @example
|
|
964
|
+
* ```ts
|
|
965
|
+
* import type { IModuleSecrets } from "@noldova/desktop.runtime";
|
|
966
|
+
* import type { FakeModuleSecrets } from "@noldova/desktop.runtime/testing";
|
|
967
|
+
*
|
|
968
|
+
* export function answerRemoveAsync(fake: FakeModuleSecrets, value: Awaited<ReturnType<IModuleSecrets["removeAsync"]>>): void {
|
|
969
|
+
* fake.answer("removeAsync", () => Promise.resolve(value));
|
|
970
|
+
* }
|
|
971
|
+
* ```
|
|
972
|
+
*/
|
|
973
|
+
public readonly removeAsync: IModuleSecrets["removeAsync"];
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* Stands in for {@link IModuleSecrets.isSetAsync}. Records each call, which
|
|
977
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
978
|
+
* {@link Fake.answer} gives returns; while unanswered, the promise it returns
|
|
979
|
+
* rejects rather than the call throwing.
|
|
980
|
+
*
|
|
981
|
+
* @throws {UnansweredCallException} As the rejection of the promise it
|
|
982
|
+
* returns, naming the member, while the test has given it no answer, as the
|
|
983
|
+
* real member fails.
|
|
984
|
+
*
|
|
985
|
+
* @example
|
|
986
|
+
* ```ts
|
|
987
|
+
* import type { IModuleSecrets } from "@noldova/desktop.runtime";
|
|
988
|
+
* import type { FakeModuleSecrets } from "@noldova/desktop.runtime/testing";
|
|
989
|
+
*
|
|
990
|
+
* export function answerIsSetAsync(fake: FakeModuleSecrets, value: Awaited<ReturnType<IModuleSecrets["isSetAsync"]>>): void {
|
|
991
|
+
* fake.answer("isSetAsync", () => Promise.resolve(value));
|
|
992
|
+
* }
|
|
993
|
+
* ```
|
|
994
|
+
*/
|
|
995
|
+
public readonly isSetAsync: IModuleSecrets["isSetAsync"];
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* A fake of {@link IRuntimePartContext.tools}, the module's agent tools, for a
|
|
1000
|
+
* module's tests: it records every call, and a test answers each member that
|
|
1001
|
+
* returns a value with {@link Fake.answer}.
|
|
1002
|
+
*
|
|
1003
|
+
* A member that returns a value, or a property, throws
|
|
1004
|
+
* {@link UnansweredCallException}, naming it, until the test answers it, so
|
|
1005
|
+
* that no test passes on a value the fake made up.
|
|
1006
|
+
*
|
|
1007
|
+
* @example
|
|
1008
|
+
* ```ts
|
|
1009
|
+
* import { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1010
|
+
*
|
|
1011
|
+
* export function running(): FakeToolsContext {
|
|
1012
|
+
* const tools = new FakeToolsContext();
|
|
1013
|
+
* tools.answer("isStopped", false);
|
|
1014
|
+
* return tools;
|
|
1015
|
+
* }
|
|
1016
|
+
* ```
|
|
1017
|
+
*
|
|
1018
|
+
* @example
|
|
1019
|
+
* ```ts
|
|
1020
|
+
* import { UnansweredCallException } from "@noldova/desktop.protocol/testing";
|
|
1021
|
+
* import { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1022
|
+
*
|
|
1023
|
+
* export function isUnanswered(): boolean {
|
|
1024
|
+
* const fake = new FakeToolsContext();
|
|
1025
|
+
* try {
|
|
1026
|
+
* void fake.isStopped;
|
|
1027
|
+
* } catch (error) {
|
|
1028
|
+
* return error instanceof UnansweredCallException;
|
|
1029
|
+
* }
|
|
1030
|
+
* return false;
|
|
1031
|
+
* }
|
|
1032
|
+
* ```
|
|
1033
|
+
*/
|
|
1034
|
+
export declare class FakeToolsContext extends Fake<IToolsContext> implements IToolsContext {
|
|
1035
|
+
/**
|
|
1036
|
+
* Makes the fake.
|
|
1037
|
+
*
|
|
1038
|
+
* @param log The log that takes a listener's failure, as the module's log
|
|
1039
|
+
* does in the runtime; by default, a {@link FakeModuleLog} of the fake's own.
|
|
1040
|
+
* {@link FakeRuntimePartContext} passes its
|
|
1041
|
+
* {@link FakeRuntimePartContext.log}.
|
|
1042
|
+
*
|
|
1043
|
+
* @example
|
|
1044
|
+
* ```ts
|
|
1045
|
+
* import { FakeModuleLog, FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1046
|
+
*
|
|
1047
|
+
* export function logged(log: FakeModuleLog): FakeToolsContext {
|
|
1048
|
+
* return new FakeToolsContext(log);
|
|
1049
|
+
* }
|
|
1050
|
+
* ```
|
|
1051
|
+
*/
|
|
1052
|
+
public constructor(log?: IModuleLog);
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Stands in for {@link IToolsContext.register}. Records each registration,
|
|
1056
|
+
* which {@link Fake.activeCallsOf} lists until the {@link Registration} it
|
|
1057
|
+
* returns is disposed. With the answer that {@link Fake.answer} gives, it
|
|
1058
|
+
* also passes the registration to that answer, such as a
|
|
1059
|
+
* `ToolRegistry`'s own, and disposing the {@link Registration} it
|
|
1060
|
+
* returns also disposes the answer's; an answer that throws keeps no
|
|
1061
|
+
* registration, and its error comes out of the call.
|
|
1062
|
+
*
|
|
1063
|
+
* @example
|
|
1064
|
+
* ```ts
|
|
1065
|
+
* import type { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1066
|
+
*
|
|
1067
|
+
* export function activeRegister(fake: FakeToolsContext): number {
|
|
1068
|
+
* return fake.activeCallsOf("register").length;
|
|
1069
|
+
* }
|
|
1070
|
+
* ```
|
|
1071
|
+
*
|
|
1072
|
+
* @example
|
|
1073
|
+
* ```ts
|
|
1074
|
+
* import { ToolDescriptor, type ToolRegistry } from "@noldova/desktop.runtime";
|
|
1075
|
+
* import type { FakeModuleLog, FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1076
|
+
*
|
|
1077
|
+
* export function serveThrough(fake: FakeToolsContext, registry: ToolRegistry, log: FakeModuleLog, tools: readonly string[]): void {
|
|
1078
|
+
* fake.answer("register", (descriptor, handler) => registry.register("notes", new ToolDescriptor(descriptor, tools), handler, tools, log));
|
|
1079
|
+
* }
|
|
1080
|
+
* ```
|
|
1081
|
+
*/
|
|
1082
|
+
public readonly register: IToolsContext["register"];
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* Stands in for {@link IToolsContext.openSession}. Records each call, which
|
|
1086
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
1087
|
+
* {@link Fake.answer} gives returns.
|
|
1088
|
+
*
|
|
1089
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
1090
|
+
* the test has given it no answer.
|
|
1091
|
+
*
|
|
1092
|
+
* @example
|
|
1093
|
+
* ```ts
|
|
1094
|
+
* import type { IToolsContext } from "@noldova/desktop.runtime";
|
|
1095
|
+
* import type { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1096
|
+
*
|
|
1097
|
+
* export function answerOpenSession(fake: FakeToolsContext, value: ReturnType<IToolsContext["openSession"]>): void {
|
|
1098
|
+
* fake.answer("openSession", () => value);
|
|
1099
|
+
* }
|
|
1100
|
+
* ```
|
|
1101
|
+
*/
|
|
1102
|
+
public readonly openSession: IToolsContext["openSession"];
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* Stands in for {@link IToolsContext.onSessionEnded}. Records each listener,
|
|
1106
|
+
* which {@link Fake.activeCallsOf} lists until the {@link Registration} it
|
|
1107
|
+
* returns is disposed, and which {@link FakeToolsContext.raiseSessionEnded}
|
|
1108
|
+
* calls. With the answer that {@link Fake.answer} gives, such as a
|
|
1109
|
+
* `ToolRegistry`'s own, the listener goes to that answer instead, and
|
|
1110
|
+
* the raiser doesn't call it; disposing the {@link Registration} it returns
|
|
1111
|
+
* also disposes the answer's.
|
|
1112
|
+
*
|
|
1113
|
+
* @example
|
|
1114
|
+
* ```ts
|
|
1115
|
+
* import type { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1116
|
+
*
|
|
1117
|
+
* export function activeOnSessionEnded(fake: FakeToolsContext): number {
|
|
1118
|
+
* return fake.activeCallsOf("onSessionEnded").length;
|
|
1119
|
+
* }
|
|
1120
|
+
* ```
|
|
1121
|
+
*/
|
|
1122
|
+
public readonly onSessionEnded: IToolsContext["onSessionEnded"];
|
|
1123
|
+
|
|
1124
|
+
/**
|
|
1125
|
+
* Stands in for {@link IToolsContext.openEndpointAsync}. Records each call,
|
|
1126
|
+
* which {@link Fake.callsOf} reads, and returns what the answer that
|
|
1127
|
+
* {@link Fake.answer} gives returns; while unanswered, the promise it returns
|
|
1128
|
+
* rejects rather than the call throwing.
|
|
1129
|
+
*
|
|
1130
|
+
* @throws {UnansweredCallException} As the rejection of the promise it
|
|
1131
|
+
* returns, naming the member, while the test has given it no answer, as the
|
|
1132
|
+
* real member fails.
|
|
1133
|
+
*
|
|
1134
|
+
* @example
|
|
1135
|
+
* ```ts
|
|
1136
|
+
* import type { IToolsContext } from "@noldova/desktop.runtime";
|
|
1137
|
+
* import type { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1138
|
+
*
|
|
1139
|
+
* export function answerOpenEndpointAsync(fake: FakeToolsContext, value: Awaited<ReturnType<IToolsContext["openEndpointAsync"]>>): void {
|
|
1140
|
+
* fake.answer("openEndpointAsync", () => Promise.resolve(value));
|
|
1141
|
+
* }
|
|
1142
|
+
* ```
|
|
1143
|
+
*/
|
|
1144
|
+
public readonly openEndpointAsync: IToolsContext["openEndpointAsync"];
|
|
1145
|
+
|
|
1146
|
+
/**
|
|
1147
|
+
* Stands in for {@link IToolsContext.stopAll}. Records each call, which
|
|
1148
|
+
* {@link Fake.callsOf} reads, and calls the answer that {@link Fake.answer}
|
|
1149
|
+
* gives; while unanswered, it only records the call.
|
|
1150
|
+
*
|
|
1151
|
+
* @example
|
|
1152
|
+
* ```ts
|
|
1153
|
+
* import type { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1154
|
+
*
|
|
1155
|
+
* export function heardStopAll(fake: FakeToolsContext): readonly unknown[][] {
|
|
1156
|
+
* const heard: unknown[][] = [];
|
|
1157
|
+
* fake.answer("stopAll", (...args) => {
|
|
1158
|
+
* heard.push(args);
|
|
1159
|
+
* });
|
|
1160
|
+
* return heard;
|
|
1161
|
+
* }
|
|
1162
|
+
* ```
|
|
1163
|
+
*/
|
|
1164
|
+
public readonly stopAll: IToolsContext["stopAll"];
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* Stands in for {@link IToolsContext.stopSession}. Records each call, which
|
|
1168
|
+
* {@link Fake.callsOf} reads, and calls the answer that {@link Fake.answer}
|
|
1169
|
+
* gives; while unanswered, it only records the call.
|
|
1170
|
+
*
|
|
1171
|
+
* @example
|
|
1172
|
+
* ```ts
|
|
1173
|
+
* import type { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1174
|
+
*
|
|
1175
|
+
* export function heardStopSession(fake: FakeToolsContext): readonly unknown[][] {
|
|
1176
|
+
* const heard: unknown[][] = [];
|
|
1177
|
+
* fake.answer("stopSession", (...args) => {
|
|
1178
|
+
* heard.push(args);
|
|
1179
|
+
* });
|
|
1180
|
+
* return heard;
|
|
1181
|
+
* }
|
|
1182
|
+
* ```
|
|
1183
|
+
*/
|
|
1184
|
+
public readonly stopSession: IToolsContext["stopSession"];
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* Stands in for {@link IToolsContext.onSessionStopped}. Records each
|
|
1188
|
+
* listener, which {@link Fake.activeCallsOf} lists until the
|
|
1189
|
+
* {@link Registration} it returns is disposed, and which
|
|
1190
|
+
* {@link FakeToolsContext.raiseSessionStopped} calls. With the answer that
|
|
1191
|
+
* {@link Fake.answer} gives, such as a `ToolRegistry`'s own, the
|
|
1192
|
+
* listener goes to that answer instead, and the raiser doesn't call it;
|
|
1193
|
+
* disposing the {@link Registration} it returns also disposes the answer's.
|
|
1194
|
+
*
|
|
1195
|
+
* @example
|
|
1196
|
+
* ```ts
|
|
1197
|
+
* import type { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1198
|
+
*
|
|
1199
|
+
* export function activeOnSessionStopped(fake: FakeToolsContext): number {
|
|
1200
|
+
* return fake.activeCallsOf("onSessionStopped").length;
|
|
1201
|
+
* }
|
|
1202
|
+
* ```
|
|
1203
|
+
*/
|
|
1204
|
+
public readonly onSessionStopped: IToolsContext["onSessionStopped"];
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* Stands in for {@link IToolsContext.resumeAll}. Records each call, which
|
|
1208
|
+
* {@link Fake.callsOf} reads, and calls the answer that {@link Fake.answer}
|
|
1209
|
+
* gives; while unanswered, it only records the call.
|
|
1210
|
+
*
|
|
1211
|
+
* @example
|
|
1212
|
+
* ```ts
|
|
1213
|
+
* import type { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1214
|
+
*
|
|
1215
|
+
* export function heardResumeAll(fake: FakeToolsContext): readonly unknown[][] {
|
|
1216
|
+
* const heard: unknown[][] = [];
|
|
1217
|
+
* fake.answer("resumeAll", (...args) => {
|
|
1218
|
+
* heard.push(args);
|
|
1219
|
+
* });
|
|
1220
|
+
* return heard;
|
|
1221
|
+
* }
|
|
1222
|
+
* ```
|
|
1223
|
+
*/
|
|
1224
|
+
public readonly resumeAll: IToolsContext["resumeAll"];
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* Stands in for {@link IToolsContext.onStopped}. Records each listener, which
|
|
1228
|
+
* {@link Fake.activeCallsOf} lists until the {@link Registration} it returns
|
|
1229
|
+
* is disposed, and which {@link FakeToolsContext.raiseStopped} calls. With
|
|
1230
|
+
* the answer that {@link Fake.answer} gives, such as a
|
|
1231
|
+
* `ToolRegistry`'s own, the listener goes to that answer instead, and
|
|
1232
|
+
* the raiser doesn't call it; disposing the {@link Registration} it returns
|
|
1233
|
+
* also disposes the answer's.
|
|
1234
|
+
*
|
|
1235
|
+
* @example
|
|
1236
|
+
* ```ts
|
|
1237
|
+
* import type { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1238
|
+
*
|
|
1239
|
+
* export function activeOnStopped(fake: FakeToolsContext): number {
|
|
1240
|
+
* return fake.activeCallsOf("onStopped").length;
|
|
1241
|
+
* }
|
|
1242
|
+
* ```
|
|
1243
|
+
*/
|
|
1244
|
+
public readonly onStopped: IToolsContext["onStopped"];
|
|
1245
|
+
|
|
1246
|
+
/**
|
|
1247
|
+
* Stands in for {@link IToolsContext.onResumed}. Records each listener, which
|
|
1248
|
+
* {@link Fake.activeCallsOf} lists until the {@link Registration} it returns
|
|
1249
|
+
* is disposed, and which {@link FakeToolsContext.raiseResumed} calls. With
|
|
1250
|
+
* the answer that {@link Fake.answer} gives, such as a
|
|
1251
|
+
* `ToolRegistry`'s own, the listener goes to that answer instead, and
|
|
1252
|
+
* the raiser doesn't call it; disposing the {@link Registration} it returns
|
|
1253
|
+
* also disposes the answer's.
|
|
1254
|
+
*
|
|
1255
|
+
* @example
|
|
1256
|
+
* ```ts
|
|
1257
|
+
* import type { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1258
|
+
*
|
|
1259
|
+
* export function activeOnResumed(fake: FakeToolsContext): number {
|
|
1260
|
+
* return fake.activeCallsOf("onResumed").length;
|
|
1261
|
+
* }
|
|
1262
|
+
* ```
|
|
1263
|
+
*/
|
|
1264
|
+
public readonly onResumed: IToolsContext["onResumed"];
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* Stands in for {@link IToolsContext.isStopped}. Reads the value that
|
|
1268
|
+
* {@link Fake.answer} gives.
|
|
1269
|
+
*
|
|
1270
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
1271
|
+
* the test has given it no answer.
|
|
1272
|
+
*
|
|
1273
|
+
* @example
|
|
1274
|
+
* ```ts
|
|
1275
|
+
* import type { IToolsContext } from "@noldova/desktop.runtime";
|
|
1276
|
+
* import type { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1277
|
+
*
|
|
1278
|
+
* export function answerIsStopped(fake: FakeToolsContext, value: IToolsContext["isStopped"]): void {
|
|
1279
|
+
* fake.answer("isStopped", value);
|
|
1280
|
+
* }
|
|
1281
|
+
* ```
|
|
1282
|
+
*/
|
|
1283
|
+
public get isStopped(): boolean;
|
|
1284
|
+
|
|
1285
|
+
/**
|
|
1286
|
+
* Tells each listener of {@link IToolsContext.onSessionEnded} that a tool
|
|
1287
|
+
* session ended.
|
|
1288
|
+
*
|
|
1289
|
+
* As Noldova Desktop's own dispatch does, it skips a listener that an earlier
|
|
1290
|
+
* one removes during the call, and one that throws stops no other: the log
|
|
1291
|
+
* the fake was made with records the line the module's log would write.
|
|
1292
|
+
*
|
|
1293
|
+
* @param session The session's id.
|
|
1294
|
+
*
|
|
1295
|
+
* @example
|
|
1296
|
+
* ```ts
|
|
1297
|
+
* import { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1298
|
+
*
|
|
1299
|
+
* export function end(tools: FakeToolsContext): void {
|
|
1300
|
+
* tools.raiseSessionEnded("session-1");
|
|
1301
|
+
* }
|
|
1302
|
+
* ```
|
|
1303
|
+
*/
|
|
1304
|
+
public raiseSessionEnded(session: string): void;
|
|
1305
|
+
|
|
1306
|
+
/**
|
|
1307
|
+
* Tells each listener of {@link IToolsContext.onSessionStopped} that the
|
|
1308
|
+
* person stopped a tool session.
|
|
1309
|
+
*
|
|
1310
|
+
* As Noldova Desktop's own dispatch does, it skips a listener that an earlier
|
|
1311
|
+
* one removes during the call, and one that throws stops no other: the log
|
|
1312
|
+
* the fake was made with records the line the module's log would write.
|
|
1313
|
+
*
|
|
1314
|
+
* @param session The session's id.
|
|
1315
|
+
*
|
|
1316
|
+
* @param reason Why it stopped.
|
|
1317
|
+
*
|
|
1318
|
+
* @example
|
|
1319
|
+
* ```ts
|
|
1320
|
+
* import { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1321
|
+
*
|
|
1322
|
+
* export function stop(tools: FakeToolsContext): void {
|
|
1323
|
+
* tools.raiseSessionStopped("session-1", "Stopped by the person.");
|
|
1324
|
+
* }
|
|
1325
|
+
* ```
|
|
1326
|
+
*/
|
|
1327
|
+
public raiseSessionStopped(session: string, reason: string): void;
|
|
1328
|
+
|
|
1329
|
+
/**
|
|
1330
|
+
* Tells each listener of {@link IToolsContext.onStopped} that every tool
|
|
1331
|
+
* stopped.
|
|
1332
|
+
*
|
|
1333
|
+
* As Noldova Desktop's own dispatch does, it skips a listener that an earlier
|
|
1334
|
+
* one removes during the call, and one that throws stops no other: the log
|
|
1335
|
+
* the fake was made with records the line the module's log would write.
|
|
1336
|
+
*
|
|
1337
|
+
* @param reason Why they stopped.
|
|
1338
|
+
*
|
|
1339
|
+
* @example
|
|
1340
|
+
* ```ts
|
|
1341
|
+
* import { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1342
|
+
*
|
|
1343
|
+
* export function stopAll(tools: FakeToolsContext): void {
|
|
1344
|
+
* tools.raiseStopped("Stopped by the person.");
|
|
1345
|
+
* }
|
|
1346
|
+
* ```
|
|
1347
|
+
*/
|
|
1348
|
+
public raiseStopped(reason: string): void;
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* Tells each listener of {@link IToolsContext.onResumed} that the tools
|
|
1352
|
+
* resumed.
|
|
1353
|
+
*
|
|
1354
|
+
* As Noldova Desktop's own dispatch does, it skips a listener that an earlier
|
|
1355
|
+
* one removes during the call, and one that throws stops no other: the log
|
|
1356
|
+
* the fake was made with records the line the module's log would write.
|
|
1357
|
+
*
|
|
1358
|
+
* @example
|
|
1359
|
+
* ```ts
|
|
1360
|
+
* import { FakeToolsContext } from "@noldova/desktop.runtime/testing";
|
|
1361
|
+
*
|
|
1362
|
+
* export function resume(tools: FakeToolsContext): void {
|
|
1363
|
+
* tools.raiseResumed();
|
|
1364
|
+
* }
|
|
1365
|
+
* ```
|
|
1366
|
+
*/
|
|
1367
|
+
public raiseResumed(): void;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
/**
|
|
1371
|
+
* A fake of {@link IRuntimePartContext.permissions}, the module's permission
|
|
1372
|
+
* answers, for a module's tests: it records every call, and a test answers each
|
|
1373
|
+
* member that returns a value with {@link Fake.answer}.
|
|
1374
|
+
*
|
|
1375
|
+
* A member that returns a value, or a property, throws
|
|
1376
|
+
* {@link UnansweredCallException}, naming it, until the test answers it, so
|
|
1377
|
+
* that no test passes on a value the fake made up.
|
|
1378
|
+
*
|
|
1379
|
+
* @example
|
|
1380
|
+
* ```ts
|
|
1381
|
+
* import { FakePermissionsContext } from "@noldova/desktop.runtime/testing";
|
|
1382
|
+
*
|
|
1383
|
+
* export function withNone(): FakePermissionsContext {
|
|
1384
|
+
* const permissions = new FakePermissionsContext();
|
|
1385
|
+
* permissions.answer("listRemembered", () => []);
|
|
1386
|
+
* return permissions;
|
|
1387
|
+
* }
|
|
1388
|
+
* ```
|
|
1389
|
+
*
|
|
1390
|
+
* @example
|
|
1391
|
+
* ```ts
|
|
1392
|
+
* import { UnansweredCallException } from "@noldova/desktop.protocol/testing";
|
|
1393
|
+
* import { FakePermissionsContext } from "@noldova/desktop.runtime/testing";
|
|
1394
|
+
*
|
|
1395
|
+
* export function isUnanswered(): boolean {
|
|
1396
|
+
* const fake = new FakePermissionsContext();
|
|
1397
|
+
* try {
|
|
1398
|
+
* fake.listRemembered();
|
|
1399
|
+
* } catch (error) {
|
|
1400
|
+
* return error instanceof UnansweredCallException;
|
|
1401
|
+
* }
|
|
1402
|
+
* return false;
|
|
1403
|
+
* }
|
|
1404
|
+
* ```
|
|
1405
|
+
*/
|
|
1406
|
+
export declare class FakePermissionsContext extends Fake<IPermissionsContext> implements IPermissionsContext {
|
|
1407
|
+
/**
|
|
1408
|
+
* Makes the fake.
|
|
1409
|
+
*
|
|
1410
|
+
* @param log The log that takes a listener's failure, as the module's log
|
|
1411
|
+
* does in the runtime; by default, a {@link FakeModuleLog} of the fake's own.
|
|
1412
|
+
* {@link FakeRuntimePartContext} passes its
|
|
1413
|
+
* {@link FakeRuntimePartContext.log}.
|
|
1414
|
+
*
|
|
1415
|
+
* @example
|
|
1416
|
+
* ```ts
|
|
1417
|
+
* import { FakeModuleLog, FakePermissionsContext } from "@noldova/desktop.runtime/testing";
|
|
1418
|
+
*
|
|
1419
|
+
* export function logged(log: FakeModuleLog): FakePermissionsContext {
|
|
1420
|
+
* return new FakePermissionsContext(log);
|
|
1421
|
+
* }
|
|
1422
|
+
* ```
|
|
1423
|
+
*/
|
|
1424
|
+
public constructor(log?: IModuleLog);
|
|
1425
|
+
|
|
1426
|
+
/**
|
|
1427
|
+
* Stands in for {@link IPermissionsContext.registerAnswerer}. Records each
|
|
1428
|
+
* registration, which {@link Fake.activeCallsOf} lists until the
|
|
1429
|
+
* {@link Registration} it returns is disposed; it takes no answer.
|
|
1430
|
+
*
|
|
1431
|
+
* @example
|
|
1432
|
+
* ```ts
|
|
1433
|
+
* import type { FakePermissionsContext } from "@noldova/desktop.runtime/testing";
|
|
1434
|
+
*
|
|
1435
|
+
* export function activeRegisterAnswerer(fake: FakePermissionsContext): number {
|
|
1436
|
+
* return fake.activeCallsOf("registerAnswerer").length;
|
|
1437
|
+
* }
|
|
1438
|
+
* ```
|
|
1439
|
+
*/
|
|
1440
|
+
public readonly registerAnswerer: IPermissionsContext["registerAnswerer"];
|
|
1441
|
+
|
|
1442
|
+
/**
|
|
1443
|
+
* Stands in for {@link IPermissionsContext.listRemembered}. Records each
|
|
1444
|
+
* call, which {@link Fake.callsOf} reads, and returns what the answer that
|
|
1445
|
+
* {@link Fake.answer} gives returns.
|
|
1446
|
+
*
|
|
1447
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
1448
|
+
* the test has given it no answer.
|
|
1449
|
+
*
|
|
1450
|
+
* @example
|
|
1451
|
+
* ```ts
|
|
1452
|
+
* import type { IPermissionsContext } from "@noldova/desktop.runtime";
|
|
1453
|
+
* import type { FakePermissionsContext } from "@noldova/desktop.runtime/testing";
|
|
1454
|
+
*
|
|
1455
|
+
* export function answerListRemembered(fake: FakePermissionsContext, value: ReturnType<IPermissionsContext["listRemembered"]>): void {
|
|
1456
|
+
* fake.answer("listRemembered", () => value);
|
|
1457
|
+
* }
|
|
1458
|
+
* ```
|
|
1459
|
+
*/
|
|
1460
|
+
public readonly listRemembered: IPermissionsContext["listRemembered"];
|
|
1461
|
+
|
|
1462
|
+
/**
|
|
1463
|
+
* Stands in for {@link IPermissionsContext.revoke}. Records each call, which
|
|
1464
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
1465
|
+
* {@link Fake.answer} gives returns.
|
|
1466
|
+
*
|
|
1467
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
1468
|
+
* the test has given it no answer.
|
|
1469
|
+
*
|
|
1470
|
+
* @example
|
|
1471
|
+
* ```ts
|
|
1472
|
+
* import type { IPermissionsContext } from "@noldova/desktop.runtime";
|
|
1473
|
+
* import type { FakePermissionsContext } from "@noldova/desktop.runtime/testing";
|
|
1474
|
+
*
|
|
1475
|
+
* export function answerRevoke(fake: FakePermissionsContext, value: ReturnType<IPermissionsContext["revoke"]>): void {
|
|
1476
|
+
* fake.answer("revoke", () => value);
|
|
1477
|
+
* }
|
|
1478
|
+
* ```
|
|
1479
|
+
*/
|
|
1480
|
+
public readonly revoke: IPermissionsContext["revoke"];
|
|
1481
|
+
|
|
1482
|
+
/**
|
|
1483
|
+
* Stands in for {@link IPermissionsContext.onRevoked}. Records each listener,
|
|
1484
|
+
* which {@link FakePermissionsContext.raiseRevoked} calls and
|
|
1485
|
+
* {@link Fake.activeCallsOf} lists until the {@link Registration} it returns
|
|
1486
|
+
* is disposed; it takes no answer.
|
|
1487
|
+
*
|
|
1488
|
+
* @example
|
|
1489
|
+
* ```ts
|
|
1490
|
+
* import type { FakePermissionsContext } from "@noldova/desktop.runtime/testing";
|
|
1491
|
+
*
|
|
1492
|
+
* export function activeOnRevoked(fake: FakePermissionsContext): number {
|
|
1493
|
+
* return fake.activeCallsOf("onRevoked").length;
|
|
1494
|
+
* }
|
|
1495
|
+
* ```
|
|
1496
|
+
*/
|
|
1497
|
+
public readonly onRevoked: IPermissionsContext["onRevoked"];
|
|
1498
|
+
|
|
1499
|
+
/**
|
|
1500
|
+
* Tells each listener of {@link IPermissionsContext.onRevoked} that the
|
|
1501
|
+
* person revoked a remembered answer.
|
|
1502
|
+
*
|
|
1503
|
+
* As Noldova Desktop's own dispatch does, it calls each listener in place when
|
|
1504
|
+
* the call starts: one that an earlier one removes during the call is still
|
|
1505
|
+
* called, and one that throws stops no other: the log the fake was made with
|
|
1506
|
+
* records the line the module's log would write.
|
|
1507
|
+
*
|
|
1508
|
+
* @param revocation The answer revoked.
|
|
1509
|
+
*
|
|
1510
|
+
* @example
|
|
1511
|
+
* ```ts
|
|
1512
|
+
* import { FakePermissionsContext } from "@noldova/desktop.runtime/testing";
|
|
1513
|
+
*
|
|
1514
|
+
* import { PermissionRevocation } from "@noldova/desktop.runtime";
|
|
1515
|
+
*
|
|
1516
|
+
* export function revoke(permissions: FakePermissionsContext): void {
|
|
1517
|
+
* permissions.raiseRevoked(new PermissionRevocation("git.push", null, "folder"));
|
|
1518
|
+
* }
|
|
1519
|
+
* ```
|
|
1520
|
+
*/
|
|
1521
|
+
public raiseRevoked(revocation: PermissionRevocation): void;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
/**
|
|
1525
|
+
* A fake of {@link IRuntimePartContext.webViews}, the module's web views as its
|
|
1526
|
+
* runtime part drives them, for a module's tests: it records every call, and a
|
|
1527
|
+
* test answers each member that returns a value with {@link Fake.answer}.
|
|
1528
|
+
*
|
|
1529
|
+
* A member that returns a value, or a property, throws
|
|
1530
|
+
* {@link UnansweredCallException}, naming it, until the test answers it, so
|
|
1531
|
+
* that no test passes on a value the fake made up.
|
|
1532
|
+
*
|
|
1533
|
+
* @example
|
|
1534
|
+
* ```ts
|
|
1535
|
+
* import { FakeRuntimeWebViews } from "@noldova/desktop.runtime/testing";
|
|
1536
|
+
*
|
|
1537
|
+
* export function withNone(): FakeRuntimeWebViews {
|
|
1538
|
+
* const webViews = new FakeRuntimeWebViews();
|
|
1539
|
+
* webViews.answer("list", () => []);
|
|
1540
|
+
* return webViews;
|
|
1541
|
+
* }
|
|
1542
|
+
* ```
|
|
1543
|
+
*
|
|
1544
|
+
* @example
|
|
1545
|
+
* ```ts
|
|
1546
|
+
* import { UnansweredCallException } from "@noldova/desktop.protocol/testing";
|
|
1547
|
+
* import { FakeRuntimeWebViews } from "@noldova/desktop.runtime/testing";
|
|
1548
|
+
*
|
|
1549
|
+
* export function isUnanswered(): boolean {
|
|
1550
|
+
* const fake = new FakeRuntimeWebViews();
|
|
1551
|
+
* try {
|
|
1552
|
+
* fake.list();
|
|
1553
|
+
* } catch (error) {
|
|
1554
|
+
* return error instanceof UnansweredCallException;
|
|
1555
|
+
* }
|
|
1556
|
+
* return false;
|
|
1557
|
+
* }
|
|
1558
|
+
* ```
|
|
1559
|
+
*/
|
|
1560
|
+
export declare class FakeRuntimeWebViews extends Fake<IRuntimeWebViews> implements IRuntimeWebViews {
|
|
1561
|
+
/**
|
|
1562
|
+
* The fake that stands in for {@link IRuntimeWebViews.relay}, with calls and
|
|
1563
|
+
* answers of its own.
|
|
1564
|
+
*/
|
|
1565
|
+
public readonly relay: FakeWebViewRelay;
|
|
1566
|
+
|
|
1567
|
+
/**
|
|
1568
|
+
* Stands in for {@link IRuntimeWebViews.list}. Records each call, which
|
|
1569
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
1570
|
+
* {@link Fake.answer} gives returns.
|
|
1571
|
+
*
|
|
1572
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
1573
|
+
* the test has given it no answer.
|
|
1574
|
+
*
|
|
1575
|
+
* @example
|
|
1576
|
+
* ```ts
|
|
1577
|
+
* import type { IRuntimeWebViews } from "@noldova/desktop.runtime";
|
|
1578
|
+
* import type { FakeRuntimeWebViews } from "@noldova/desktop.runtime/testing";
|
|
1579
|
+
*
|
|
1580
|
+
* export function answerList(fake: FakeRuntimeWebViews, value: ReturnType<IRuntimeWebViews["list"]>): void {
|
|
1581
|
+
* fake.answer("list", () => value);
|
|
1582
|
+
* }
|
|
1583
|
+
* ```
|
|
1584
|
+
*/
|
|
1585
|
+
public readonly list: IRuntimeWebViews["list"];
|
|
1586
|
+
|
|
1587
|
+
/**
|
|
1588
|
+
* Stands in for {@link IRuntimeWebViews.navigateAsync}. Records each call,
|
|
1589
|
+
* which {@link Fake.callsOf} reads, and returns what the answer that
|
|
1590
|
+
* {@link Fake.answer} gives returns; while unanswered, the promise it returns
|
|
1591
|
+
* rejects rather than the call throwing.
|
|
1592
|
+
*
|
|
1593
|
+
* @throws {UnansweredCallException} As the rejection of the promise it
|
|
1594
|
+
* returns, naming the member, while the test has given it no answer, as the
|
|
1595
|
+
* real member fails.
|
|
1596
|
+
*
|
|
1597
|
+
* @example
|
|
1598
|
+
* ```ts
|
|
1599
|
+
* import type { IRuntimeWebViews } from "@noldova/desktop.runtime";
|
|
1600
|
+
* import type { FakeRuntimeWebViews } from "@noldova/desktop.runtime/testing";
|
|
1601
|
+
*
|
|
1602
|
+
* export function answerNavigateAsync(fake: FakeRuntimeWebViews, value: Awaited<ReturnType<IRuntimeWebViews["navigateAsync"]>>): void {
|
|
1603
|
+
* fake.answer("navigateAsync", () => Promise.resolve(value));
|
|
1604
|
+
* }
|
|
1605
|
+
* ```
|
|
1606
|
+
*/
|
|
1607
|
+
public readonly navigateAsync: IRuntimeWebViews["navigateAsync"];
|
|
1608
|
+
|
|
1609
|
+
/**
|
|
1610
|
+
* Stands in for {@link IRuntimeWebViews.actAsync}. Records each call, which
|
|
1611
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
1612
|
+
* {@link Fake.answer} gives returns; while unanswered, the promise it returns
|
|
1613
|
+
* rejects rather than the call throwing.
|
|
1614
|
+
*
|
|
1615
|
+
* @throws {UnansweredCallException} As the rejection of the promise it
|
|
1616
|
+
* returns, naming the member, while the test has given it no answer, as the
|
|
1617
|
+
* real member fails.
|
|
1618
|
+
*
|
|
1619
|
+
* @example
|
|
1620
|
+
* ```ts
|
|
1621
|
+
* import type { IRuntimeWebViews } from "@noldova/desktop.runtime";
|
|
1622
|
+
* import type { FakeRuntimeWebViews } from "@noldova/desktop.runtime/testing";
|
|
1623
|
+
*
|
|
1624
|
+
* export function answerActAsync(fake: FakeRuntimeWebViews, value: Awaited<ReturnType<IRuntimeWebViews["actAsync"]>>): void {
|
|
1625
|
+
* fake.answer("actAsync", () => Promise.resolve(value));
|
|
1626
|
+
* }
|
|
1627
|
+
* ```
|
|
1628
|
+
*/
|
|
1629
|
+
public readonly actAsync: IRuntimeWebViews["actAsync"];
|
|
1630
|
+
|
|
1631
|
+
/**
|
|
1632
|
+
* Stands in for {@link IRuntimeWebViews.setAllowedOriginsAsync}. Records each
|
|
1633
|
+
* call, which {@link Fake.callsOf} reads, and returns what the answer that
|
|
1634
|
+
* {@link Fake.answer} gives returns; while unanswered, the promise it returns
|
|
1635
|
+
* rejects rather than the call throwing.
|
|
1636
|
+
*
|
|
1637
|
+
* @throws {UnansweredCallException} As the rejection of the promise it
|
|
1638
|
+
* returns, naming the member, while the test has given it no answer, as the
|
|
1639
|
+
* real member fails.
|
|
1640
|
+
*
|
|
1641
|
+
* @example
|
|
1642
|
+
* ```ts
|
|
1643
|
+
* import type { IRuntimeWebViews } from "@noldova/desktop.runtime";
|
|
1644
|
+
* import type { FakeRuntimeWebViews } from "@noldova/desktop.runtime/testing";
|
|
1645
|
+
*
|
|
1646
|
+
* export function answerSetAllowedOriginsAsync(fake: FakeRuntimeWebViews, value: Awaited<ReturnType<IRuntimeWebViews["setAllowedOriginsAsync"]>>): void {
|
|
1647
|
+
* fake.answer("setAllowedOriginsAsync", () => Promise.resolve(value));
|
|
1648
|
+
* }
|
|
1649
|
+
* ```
|
|
1650
|
+
*/
|
|
1651
|
+
public readonly setAllowedOriginsAsync: IRuntimeWebViews["setAllowedOriginsAsync"];
|
|
1652
|
+
|
|
1653
|
+
/**
|
|
1654
|
+
* Stands in for {@link IRuntimeWebViews.clearProfileAsync}. Records each
|
|
1655
|
+
* call, which {@link Fake.callsOf} reads, and returns what the answer that
|
|
1656
|
+
* {@link Fake.answer} gives returns; while unanswered, the promise it returns
|
|
1657
|
+
* rejects rather than the call throwing.
|
|
1658
|
+
*
|
|
1659
|
+
* @throws {UnansweredCallException} As the rejection of the promise it
|
|
1660
|
+
* returns, naming the member, while the test has given it no answer, as the
|
|
1661
|
+
* real member fails.
|
|
1662
|
+
*
|
|
1663
|
+
* @example
|
|
1664
|
+
* ```ts
|
|
1665
|
+
* import type { IRuntimeWebViews } from "@noldova/desktop.runtime";
|
|
1666
|
+
* import type { FakeRuntimeWebViews } from "@noldova/desktop.runtime/testing";
|
|
1667
|
+
*
|
|
1668
|
+
* export function answerClearProfileAsync(fake: FakeRuntimeWebViews, value: Awaited<ReturnType<IRuntimeWebViews["clearProfileAsync"]>>): void {
|
|
1669
|
+
* fake.answer("clearProfileAsync", () => Promise.resolve(value));
|
|
1670
|
+
* }
|
|
1671
|
+
* ```
|
|
1672
|
+
*/
|
|
1673
|
+
public readonly clearProfileAsync: IRuntimeWebViews["clearProfileAsync"];
|
|
1674
|
+
|
|
1675
|
+
/**
|
|
1676
|
+
* Stands in for {@link IRuntimeWebViews.onViewEvent}. Records each listener,
|
|
1677
|
+
* which {@link FakeRuntimeWebViews.raiseViewEvent} calls and
|
|
1678
|
+
* {@link Fake.activeCallsOf} lists until the disposer it returns runs; it
|
|
1679
|
+
* takes no answer.
|
|
1680
|
+
*
|
|
1681
|
+
* @example
|
|
1682
|
+
* ```ts
|
|
1683
|
+
* import type { FakeRuntimeWebViews } from "@noldova/desktop.runtime/testing";
|
|
1684
|
+
*
|
|
1685
|
+
* export function activeOnViewEvent(fake: FakeRuntimeWebViews): number {
|
|
1686
|
+
* return fake.activeCallsOf("onViewEvent").length;
|
|
1687
|
+
* }
|
|
1688
|
+
* ```
|
|
1689
|
+
*/
|
|
1690
|
+
public readonly onViewEvent: IRuntimeWebViews["onViewEvent"];
|
|
1691
|
+
|
|
1692
|
+
/**
|
|
1693
|
+
* Tells each listener of {@link IRuntimeWebViews.onViewEvent} what happened
|
|
1694
|
+
* in one of the module's web views.
|
|
1695
|
+
*
|
|
1696
|
+
* As Noldova Desktop's own dispatch does, it calls each listener in place when
|
|
1697
|
+
* the call starts: one that an earlier one removes during the call is still
|
|
1698
|
+
* called, and one that throws stops no other: {@link Fake.errors} keeps what
|
|
1699
|
+
* it threw, where Noldova Desktop reports it in a place a test can't read.
|
|
1700
|
+
*
|
|
1701
|
+
* @param event What happened.
|
|
1702
|
+
*
|
|
1703
|
+
* @example
|
|
1704
|
+
* ```ts
|
|
1705
|
+
* import { FakeRuntimeWebViews } from "@noldova/desktop.runtime/testing";
|
|
1706
|
+
*
|
|
1707
|
+
* import { WebViewEvent, WebViewEventKind } from "@noldova/desktop.protocol";
|
|
1708
|
+
*
|
|
1709
|
+
* export function close(webViews: FakeRuntimeWebViews): void {
|
|
1710
|
+
* webViews.raiseViewEvent(new WebViewEvent("notes", "view-1", WebViewEventKind.Closed));
|
|
1711
|
+
* }
|
|
1712
|
+
* ```
|
|
1713
|
+
*/
|
|
1714
|
+
public raiseViewEvent(event: WebViewEvent): void;
|
|
1715
|
+
|
|
1716
|
+
/**
|
|
1717
|
+
* The fakes it holds, its relay, which {@link Fake.beStrict} makes strict
|
|
1718
|
+
* with it.
|
|
1719
|
+
*
|
|
1720
|
+
* @returns The fakes it holds.
|
|
1721
|
+
*
|
|
1722
|
+
* @example
|
|
1723
|
+
* ```ts
|
|
1724
|
+
* import { FakeRuntimeWebViews } from "@noldova/desktop.runtime/testing";
|
|
1725
|
+
*
|
|
1726
|
+
* export function strict(): FakeRuntimeWebViews {
|
|
1727
|
+
* const fake = new FakeRuntimeWebViews();
|
|
1728
|
+
* fake.beStrict();
|
|
1729
|
+
* return fake;
|
|
1730
|
+
* }
|
|
1731
|
+
* ```
|
|
1732
|
+
*/
|
|
1733
|
+
protected override parts(): readonly Pick<Fake<object>, "beStrict">[];
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
/**
|
|
1737
|
+
* A fake of {@link IRuntimeWebViews.relay}, the protocol relay to the module's
|
|
1738
|
+
* web views, for a module's tests: it records every call, and a test answers
|
|
1739
|
+
* each member that returns a value with {@link Fake.answer}.
|
|
1740
|
+
*
|
|
1741
|
+
* A member that returns a value, or a property, throws
|
|
1742
|
+
* {@link UnansweredCallException}, naming it, until the test answers it, so
|
|
1743
|
+
* that no test passes on a value the fake made up.
|
|
1744
|
+
*
|
|
1745
|
+
* @example
|
|
1746
|
+
* ```ts
|
|
1747
|
+
* import { FakeWebViewRelay } from "@noldova/desktop.runtime/testing";
|
|
1748
|
+
*
|
|
1749
|
+
* export function answering(): FakeWebViewRelay {
|
|
1750
|
+
* const relay = new FakeWebViewRelay();
|
|
1751
|
+
* relay.answer("sendAsync", () => Promise.resolve({}));
|
|
1752
|
+
* return relay;
|
|
1753
|
+
* }
|
|
1754
|
+
* ```
|
|
1755
|
+
*
|
|
1756
|
+
* @example
|
|
1757
|
+
* ```ts
|
|
1758
|
+
* import { UnansweredCallException } from "@noldova/desktop.protocol/testing";
|
|
1759
|
+
* import { FakeWebViewRelay } from "@noldova/desktop.runtime/testing";
|
|
1760
|
+
*
|
|
1761
|
+
* export async function isUnansweredAsync(): Promise<boolean> {
|
|
1762
|
+
* const fake = new FakeWebViewRelay();
|
|
1763
|
+
* try {
|
|
1764
|
+
* await fake.sendAsync("view-1", "Page.reload", {}, 1000);
|
|
1765
|
+
* } catch (error) {
|
|
1766
|
+
* return error instanceof UnansweredCallException;
|
|
1767
|
+
* }
|
|
1768
|
+
* return false;
|
|
1769
|
+
* }
|
|
1770
|
+
* ```
|
|
1771
|
+
*/
|
|
1772
|
+
export declare class FakeWebViewRelay extends Fake<IWebViewRelay> implements IWebViewRelay {
|
|
1773
|
+
/**
|
|
1774
|
+
* Stands in for {@link IWebViewRelay.sendAsync}. Records each call, which
|
|
1775
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
1776
|
+
* {@link Fake.answer} gives returns; while unanswered, the promise it returns
|
|
1777
|
+
* rejects rather than the call throwing.
|
|
1778
|
+
*
|
|
1779
|
+
* @throws {UnansweredCallException} As the rejection of the promise it
|
|
1780
|
+
* returns, naming the member, while the test has given it no answer, as the
|
|
1781
|
+
* real member fails.
|
|
1782
|
+
*
|
|
1783
|
+
* @example
|
|
1784
|
+
* ```ts
|
|
1785
|
+
* import type { IWebViewRelay } from "@noldova/desktop.runtime";
|
|
1786
|
+
* import type { FakeWebViewRelay } from "@noldova/desktop.runtime/testing";
|
|
1787
|
+
*
|
|
1788
|
+
* export function answerSendAsync(fake: FakeWebViewRelay, value: Awaited<ReturnType<IWebViewRelay["sendAsync"]>>): void {
|
|
1789
|
+
* fake.answer("sendAsync", () => Promise.resolve(value));
|
|
1790
|
+
* }
|
|
1791
|
+
* ```
|
|
1792
|
+
*/
|
|
1793
|
+
public readonly sendAsync: IWebViewRelay["sendAsync"];
|
|
1794
|
+
|
|
1795
|
+
/**
|
|
1796
|
+
* Stands in for {@link IWebViewRelay.onProtocolEvent}. Records each listener,
|
|
1797
|
+
* which {@link FakeWebViewRelay.raiseProtocolEvent} calls and
|
|
1798
|
+
* {@link Fake.activeCallsOf} lists until the disposer it returns runs; it
|
|
1799
|
+
* takes no answer.
|
|
1800
|
+
*
|
|
1801
|
+
* @example
|
|
1802
|
+
* ```ts
|
|
1803
|
+
* import type { FakeWebViewRelay } from "@noldova/desktop.runtime/testing";
|
|
1804
|
+
*
|
|
1805
|
+
* export function activeOnProtocolEvent(fake: FakeWebViewRelay): number {
|
|
1806
|
+
* return fake.activeCallsOf("onProtocolEvent").length;
|
|
1807
|
+
* }
|
|
1808
|
+
* ```
|
|
1809
|
+
*/
|
|
1810
|
+
public readonly onProtocolEvent: IWebViewRelay["onProtocolEvent"];
|
|
1811
|
+
|
|
1812
|
+
/**
|
|
1813
|
+
* Tells each listener of {@link IWebViewRelay.onProtocolEvent} for the web
|
|
1814
|
+
* view that its page sent a protocol event.
|
|
1815
|
+
*
|
|
1816
|
+
* As Noldova Desktop's own dispatch does, it calls each listener in place when
|
|
1817
|
+
* the call starts: one that an earlier one removes during the call is still
|
|
1818
|
+
* called, and one that throws stops no other: {@link Fake.errors} keeps what
|
|
1819
|
+
* it threw, where Noldova Desktop reports it in a place a test can't read.
|
|
1820
|
+
*
|
|
1821
|
+
* @param id The web view's id.
|
|
1822
|
+
*
|
|
1823
|
+
* @param event The event.
|
|
1824
|
+
*
|
|
1825
|
+
* @example
|
|
1826
|
+
* ```ts
|
|
1827
|
+
* import { FakeWebViewRelay } from "@noldova/desktop.runtime/testing";
|
|
1828
|
+
*
|
|
1829
|
+
* import { WebViewProtocolEvent } from "@noldova/desktop.runtime";
|
|
1830
|
+
*
|
|
1831
|
+
* export function load(relay: FakeWebViewRelay): void {
|
|
1832
|
+
* relay.raiseProtocolEvent("view-1", new WebViewProtocolEvent("view-1", "Page.loadEventFired", {}, false));
|
|
1833
|
+
* }
|
|
1834
|
+
* ```
|
|
1835
|
+
*/
|
|
1836
|
+
public raiseProtocolEvent(id: string, event: WebViewProtocolEvent): void;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
/**
|
|
1840
|
+
* A fake of {@link IRuntimePartContext.files}, the files the window granted the
|
|
1841
|
+
* module, for a module's tests: it records every call, and a test answers each
|
|
1842
|
+
* member that returns a value with {@link Fake.answer}.
|
|
1843
|
+
*
|
|
1844
|
+
* A member that returns a value, or a property, throws
|
|
1845
|
+
* {@link UnansweredCallException}, naming it, until the test answers it, so
|
|
1846
|
+
* that no test passes on a value the fake made up.
|
|
1847
|
+
*
|
|
1848
|
+
* @example
|
|
1849
|
+
* ```ts
|
|
1850
|
+
* import { FakeRuntimeFiles } from "@noldova/desktop.runtime/testing";
|
|
1851
|
+
*
|
|
1852
|
+
* export function sharing(): FakeRuntimeFiles {
|
|
1853
|
+
* const files = new FakeRuntimeFiles();
|
|
1854
|
+
* files.answer("shareAsync", () => Promise.resolve("grant-1"));
|
|
1855
|
+
* return files;
|
|
1856
|
+
* }
|
|
1857
|
+
* ```
|
|
1858
|
+
*
|
|
1859
|
+
* @example
|
|
1860
|
+
* ```ts
|
|
1861
|
+
* import type { RequestContext } from "@noldova/desktop.runtime";
|
|
1862
|
+
* import { UnansweredCallException } from "@noldova/desktop.protocol/testing";
|
|
1863
|
+
* import { FakeRuntimeFiles } from "@noldova/desktop.runtime/testing";
|
|
1864
|
+
*
|
|
1865
|
+
* export async function isUnansweredAsync(request: RequestContext): Promise<boolean> {
|
|
1866
|
+
* const fake = new FakeRuntimeFiles();
|
|
1867
|
+
* try {
|
|
1868
|
+
* await fake.redeemAsync("grant-1", request);
|
|
1869
|
+
* } catch (error) {
|
|
1870
|
+
* return error instanceof UnansweredCallException;
|
|
1871
|
+
* }
|
|
1872
|
+
* return false;
|
|
1873
|
+
* }
|
|
1874
|
+
* ```
|
|
1875
|
+
*/
|
|
1876
|
+
export declare class FakeRuntimeFiles extends Fake<IRuntimeFiles> implements IRuntimeFiles {
|
|
1877
|
+
/**
|
|
1878
|
+
* Stands in for {@link IRuntimeFiles.redeemAsync}. Records each call, which
|
|
1879
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
1880
|
+
* {@link Fake.answer} gives returns; while unanswered, the promise it returns
|
|
1881
|
+
* rejects rather than the call throwing.
|
|
1882
|
+
*
|
|
1883
|
+
* @throws {UnansweredCallException} As the rejection of the promise it
|
|
1884
|
+
* returns, naming the member, while the test has given it no answer, as the
|
|
1885
|
+
* real member fails.
|
|
1886
|
+
*
|
|
1887
|
+
* @example
|
|
1888
|
+
* ```ts
|
|
1889
|
+
* import type { IRuntimeFiles } from "@noldova/desktop.runtime";
|
|
1890
|
+
* import type { FakeRuntimeFiles } from "@noldova/desktop.runtime/testing";
|
|
1891
|
+
*
|
|
1892
|
+
* export function answerRedeemAsync(fake: FakeRuntimeFiles, value: Awaited<ReturnType<IRuntimeFiles["redeemAsync"]>>): void {
|
|
1893
|
+
* fake.answer("redeemAsync", () => Promise.resolve(value));
|
|
1894
|
+
* }
|
|
1895
|
+
* ```
|
|
1896
|
+
*/
|
|
1897
|
+
public readonly redeemAsync: IRuntimeFiles["redeemAsync"];
|
|
1898
|
+
|
|
1899
|
+
/**
|
|
1900
|
+
* Stands in for {@link IRuntimeFiles.shareAsync}. Records each call, which
|
|
1901
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
1902
|
+
* {@link Fake.answer} gives returns; while unanswered, the promise it returns
|
|
1903
|
+
* rejects rather than the call throwing.
|
|
1904
|
+
*
|
|
1905
|
+
* @throws {UnansweredCallException} As the rejection of the promise it
|
|
1906
|
+
* returns, naming the member, while the test has given it no answer, as the
|
|
1907
|
+
* real member fails.
|
|
1908
|
+
*
|
|
1909
|
+
* @example
|
|
1910
|
+
* ```ts
|
|
1911
|
+
* import type { IRuntimeFiles } from "@noldova/desktop.runtime";
|
|
1912
|
+
* import type { FakeRuntimeFiles } from "@noldova/desktop.runtime/testing";
|
|
1913
|
+
*
|
|
1914
|
+
* export function answerShareAsync(fake: FakeRuntimeFiles, value: Awaited<ReturnType<IRuntimeFiles["shareAsync"]>>): void {
|
|
1915
|
+
* fake.answer("shareAsync", () => Promise.resolve(value));
|
|
1916
|
+
* }
|
|
1917
|
+
* ```
|
|
1918
|
+
*/
|
|
1919
|
+
public readonly shareAsync: IRuntimeFiles["shareAsync"];
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
/**
|
|
1923
|
+
* A fake of {@link IRuntimePartContext.appWindows}, the app's open windows, for
|
|
1924
|
+
* a module's tests: it records every call, and a test answers each member that
|
|
1925
|
+
* returns a value with {@link Fake.answer}.
|
|
1926
|
+
*
|
|
1927
|
+
* A member that returns a value, or a property, throws
|
|
1928
|
+
* {@link UnansweredCallException}, naming it, until the test answers it, so
|
|
1929
|
+
* that no test passes on a value the fake made up.
|
|
1930
|
+
*
|
|
1931
|
+
* @example
|
|
1932
|
+
* ```ts
|
|
1933
|
+
* import { FakeAppWindows } from "@noldova/desktop.runtime/testing";
|
|
1934
|
+
*
|
|
1935
|
+
* export function withNone(): FakeAppWindows {
|
|
1936
|
+
* const windows = new FakeAppWindows();
|
|
1937
|
+
* windows.answer("list", () => []);
|
|
1938
|
+
* return windows;
|
|
1939
|
+
* }
|
|
1940
|
+
* ```
|
|
1941
|
+
*
|
|
1942
|
+
* @example
|
|
1943
|
+
* ```ts
|
|
1944
|
+
* import { UnansweredCallException } from "@noldova/desktop.protocol/testing";
|
|
1945
|
+
* import { FakeAppWindows } from "@noldova/desktop.runtime/testing";
|
|
1946
|
+
*
|
|
1947
|
+
* export function isUnanswered(): boolean {
|
|
1948
|
+
* const fake = new FakeAppWindows();
|
|
1949
|
+
* try {
|
|
1950
|
+
* fake.list();
|
|
1951
|
+
* } catch (error) {
|
|
1952
|
+
* return error instanceof UnansweredCallException;
|
|
1953
|
+
* }
|
|
1954
|
+
* return false;
|
|
1955
|
+
* }
|
|
1956
|
+
* ```
|
|
1957
|
+
*/
|
|
1958
|
+
export declare class FakeAppWindows extends Fake<IAppWindows> implements IAppWindows {
|
|
1959
|
+
/**
|
|
1960
|
+
* Stands in for {@link IAppWindows.list}. Records each call, which
|
|
1961
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
1962
|
+
* {@link Fake.answer} gives returns.
|
|
1963
|
+
*
|
|
1964
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
1965
|
+
* the test has given it no answer.
|
|
1966
|
+
*
|
|
1967
|
+
* @example
|
|
1968
|
+
* ```ts
|
|
1969
|
+
* import type { IAppWindows } from "@noldova/desktop.runtime";
|
|
1970
|
+
* import type { FakeAppWindows } from "@noldova/desktop.runtime/testing";
|
|
1971
|
+
*
|
|
1972
|
+
* export function answerList(fake: FakeAppWindows, value: ReturnType<IAppWindows["list"]>): void {
|
|
1973
|
+
* fake.answer("list", () => value);
|
|
1974
|
+
* }
|
|
1975
|
+
* ```
|
|
1976
|
+
*/
|
|
1977
|
+
public readonly list: IAppWindows["list"];
|
|
1978
|
+
|
|
1979
|
+
/**
|
|
1980
|
+
* Stands in for {@link IAppWindows.onChanged}. Records each listener, which
|
|
1981
|
+
* {@link FakeAppWindows.raiseChanged} calls and {@link Fake.activeCallsOf}
|
|
1982
|
+
* lists until the disposer it returns runs; it takes no answer.
|
|
1983
|
+
*
|
|
1984
|
+
* @example
|
|
1985
|
+
* ```ts
|
|
1986
|
+
* import type { FakeAppWindows } from "@noldova/desktop.runtime/testing";
|
|
1987
|
+
*
|
|
1988
|
+
* export function activeOnChanged(fake: FakeAppWindows): number {
|
|
1989
|
+
* return fake.activeCallsOf("onChanged").length;
|
|
1990
|
+
* }
|
|
1991
|
+
* ```
|
|
1992
|
+
*/
|
|
1993
|
+
public readonly onChanged: IAppWindows["onChanged"];
|
|
1994
|
+
|
|
1995
|
+
/**
|
|
1996
|
+
* Tells each listener of {@link IAppWindows.onChanged} that a window opened,
|
|
1997
|
+
* closed or changed.
|
|
1998
|
+
*
|
|
1999
|
+
* As Noldova Desktop's own dispatch does, it skips a listener that an earlier
|
|
2000
|
+
* one removes during the call, and one that throws stops no other:
|
|
2001
|
+
* {@link Fake.errors} keeps what it threw, where Noldova Desktop reports it in a
|
|
2002
|
+
* place a test can't read.
|
|
2003
|
+
*
|
|
2004
|
+
* @example
|
|
2005
|
+
* ```ts
|
|
2006
|
+
* import { FakeAppWindows } from "@noldova/desktop.runtime/testing";
|
|
2007
|
+
*
|
|
2008
|
+
* export function change(windows: FakeAppWindows): void {
|
|
2009
|
+
* windows.raiseChanged();
|
|
2010
|
+
* }
|
|
2011
|
+
* ```
|
|
2012
|
+
*/
|
|
2013
|
+
public raiseChanged(): void;
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
/**
|
|
2017
|
+
* A fake of {@link IRuntimePartContext.shortcuts}, the app's own shortcuts, for
|
|
2018
|
+
* a module's tests: it records every call, and a test answers each member that
|
|
2019
|
+
* returns a value with {@link Fake.answer}.
|
|
2020
|
+
*
|
|
2021
|
+
* A member that returns a value, or a property, throws
|
|
2022
|
+
* {@link UnansweredCallException}, naming it, until the test answers it, so
|
|
2023
|
+
* that no test passes on a value the fake made up.
|
|
2024
|
+
*
|
|
2025
|
+
* @example
|
|
2026
|
+
* ```ts
|
|
2027
|
+
* import { FakeAppShortcuts } from "@noldova/desktop.runtime/testing";
|
|
2028
|
+
*
|
|
2029
|
+
* export function withNone(): FakeAppShortcuts {
|
|
2030
|
+
* const shortcuts = new FakeAppShortcuts();
|
|
2031
|
+
* shortcuts.answer("list", () => []);
|
|
2032
|
+
* return shortcuts;
|
|
2033
|
+
* }
|
|
2034
|
+
* ```
|
|
2035
|
+
*
|
|
2036
|
+
* @example
|
|
2037
|
+
* ```ts
|
|
2038
|
+
* import { UnansweredCallException } from "@noldova/desktop.protocol/testing";
|
|
2039
|
+
* import { FakeAppShortcuts } from "@noldova/desktop.runtime/testing";
|
|
2040
|
+
*
|
|
2041
|
+
* export function isUnanswered(): boolean {
|
|
2042
|
+
* const fake = new FakeAppShortcuts();
|
|
2043
|
+
* try {
|
|
2044
|
+
* fake.list();
|
|
2045
|
+
* } catch (error) {
|
|
2046
|
+
* return error instanceof UnansweredCallException;
|
|
2047
|
+
* }
|
|
2048
|
+
* return false;
|
|
2049
|
+
* }
|
|
2050
|
+
* ```
|
|
2051
|
+
*/
|
|
2052
|
+
export declare class FakeAppShortcuts extends Fake<IAppShortcuts> implements IAppShortcuts {
|
|
2053
|
+
/**
|
|
2054
|
+
* Stands in for {@link IAppShortcuts.list}. Records each call, which
|
|
2055
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
2056
|
+
* {@link Fake.answer} gives returns.
|
|
2057
|
+
*
|
|
2058
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
2059
|
+
* the test has given it no answer.
|
|
2060
|
+
*
|
|
2061
|
+
* @example
|
|
2062
|
+
* ```ts
|
|
2063
|
+
* import type { IAppShortcuts } from "@noldova/desktop.runtime";
|
|
2064
|
+
* import type { FakeAppShortcuts } from "@noldova/desktop.runtime/testing";
|
|
2065
|
+
*
|
|
2066
|
+
* export function answerList(fake: FakeAppShortcuts, value: ReturnType<IAppShortcuts["list"]>): void {
|
|
2067
|
+
* fake.answer("list", () => value);
|
|
2068
|
+
* }
|
|
2069
|
+
* ```
|
|
2070
|
+
*/
|
|
2071
|
+
public readonly list: IAppShortcuts["list"];
|
|
2072
|
+
|
|
2073
|
+
/**
|
|
2074
|
+
* Stands in for {@link IAppShortcuts.has}. Records each call, which
|
|
2075
|
+
* {@link Fake.callsOf} reads, and returns what the answer that
|
|
2076
|
+
* {@link Fake.answer} gives returns.
|
|
2077
|
+
*
|
|
2078
|
+
* @throws {UnansweredCallException} Synchronously, naming the member, while
|
|
2079
|
+
* the test has given it no answer.
|
|
2080
|
+
*
|
|
2081
|
+
* @example
|
|
2082
|
+
* ```ts
|
|
2083
|
+
* import type { IAppShortcuts } from "@noldova/desktop.runtime";
|
|
2084
|
+
* import type { FakeAppShortcuts } from "@noldova/desktop.runtime/testing";
|
|
2085
|
+
*
|
|
2086
|
+
* export function answerHas(fake: FakeAppShortcuts, value: ReturnType<IAppShortcuts["has"]>): void {
|
|
2087
|
+
* fake.answer("has", () => value);
|
|
2088
|
+
* }
|
|
2089
|
+
* ```
|
|
2090
|
+
*/
|
|
2091
|
+
public readonly has: IAppShortcuts["has"];
|
|
2092
|
+
|
|
2093
|
+
/**
|
|
2094
|
+
* Stands in for {@link IAppShortcuts.onChanged}. Records each listener, which
|
|
2095
|
+
* {@link FakeAppShortcuts.raiseChanged} calls and {@link Fake.activeCallsOf}
|
|
2096
|
+
* lists until the disposer it returns runs; it takes no answer.
|
|
2097
|
+
*
|
|
2098
|
+
* @example
|
|
2099
|
+
* ```ts
|
|
2100
|
+
* import type { FakeAppShortcuts } from "@noldova/desktop.runtime/testing";
|
|
2101
|
+
*
|
|
2102
|
+
* export function activeOnChanged(fake: FakeAppShortcuts): number {
|
|
2103
|
+
* return fake.activeCallsOf("onChanged").length;
|
|
2104
|
+
* }
|
|
2105
|
+
* ```
|
|
2106
|
+
*/
|
|
2107
|
+
public readonly onChanged: IAppShortcuts["onChanged"];
|
|
2108
|
+
|
|
2109
|
+
/**
|
|
2110
|
+
* Tells each listener of {@link IAppShortcuts.onChanged} that the app's
|
|
2111
|
+
* shortcuts changed.
|
|
2112
|
+
*
|
|
2113
|
+
* As Noldova Desktop's own dispatch does, it skips a listener that an earlier
|
|
2114
|
+
* one removes during the call, and one that throws stops no other:
|
|
2115
|
+
* {@link Fake.errors} keeps what it threw, where Noldova Desktop reports it in a
|
|
2116
|
+
* place a test can't read.
|
|
2117
|
+
*
|
|
2118
|
+
* @example
|
|
2119
|
+
* ```ts
|
|
2120
|
+
* import { FakeAppShortcuts } from "@noldova/desktop.runtime/testing";
|
|
2121
|
+
*
|
|
2122
|
+
* export function change(shortcuts: FakeAppShortcuts): void {
|
|
2123
|
+
* shortcuts.raiseChanged();
|
|
2124
|
+
* }
|
|
2125
|
+
* ```
|
|
2126
|
+
*/
|
|
2127
|
+
public raiseChanged(): void;
|
|
2128
|
+
}
|