{"version":3,"file":"mock-error.cjs","sourceRoot":"","sources":["../../../src/dmk/__testhelpers__/mock-error.ts"],"names":[],"mappings":";;;AAEA,gGAAiF;AAEjF;;;;;;;;;GASG;AACH,SAAgB,6BAA6B,CAC3C,SAAqB;IAErB,OAAO;QACL,IAAI,EAAE,6DAAyB;QAC/B,OAAO,EAAE,cAAc,MAAM,CAAC,SAAS,CAAC,EAAE;QAC1C,SAAS;QACT,aAAa,EAAE,SAAS;KACqB,CAAC;AAClD,CAAC;AATD,sEASC","sourcesContent":["import type { DeviceExchangeError } from '@ledgerhq/device-management-kit';\n\nimport { ETH_APP_COMMAND_ERROR_TAG } from '../eth-get-app-configuration-command';\n\n/**\n * Construct a mock {@link DeviceExchangeError} for tests.\n *\n * The DMK `DeviceExchangeError` is normally raised inside the DMK runtime;\n * tests need a structurally-equivalent value without going through DMK.\n * This helper centralises the cast so test files don't each roll their own.\n *\n * @param errorCode - The hex error code to embed (e.g. `'6985'`).\n * @returns A mock `DeviceExchangeError<TErrorCode>`.\n */\nexport function createMockDeviceExchangeError<TErrorCode = string>(\n  errorCode: TErrorCode,\n): DeviceExchangeError<TErrorCode> {\n  return {\n    _tag: ETH_APP_COMMAND_ERROR_TAG,\n    message: `DMK error: ${String(errorCode)}`,\n    errorCode,\n    originalError: undefined,\n  } as unknown as DeviceExchangeError<TErrorCode>;\n}\n"]}