Bug Description
When importing a valid JSON that lacks the steps property, chainService.importChain() throws a TypeError: Cannot read properties of undefined (reading 'map') instead of the expected Error("Invalid chain data").
Steps to Reproduce
- Create a JSON file without a
steps field:
{
"name": "sample chain"
}
- Call :
await chainService.importChain(validJsonWithoutSteps);
3.Observe the thrown error.
Expected Behavior
The function should throw a controlled error:
Error: Invalid chain data
Actual Behavior
The function throws a TypeError:
Cannot read properties of undefined (reading 'map')
Environment
Vitest/ui v4.0.5
Vitest/coverage-v8 v4.0.4
Node.js v22.2.0
OS: Windows 11
File: src/lib/chain-service.ts
Test file: chain-service.test.ts
Screenshots
Additional Context
No response
Bug Description
When importing a valid JSON that lacks the
stepsproperty,chainService.importChain()throws aTypeError: Cannot read properties of undefined (reading 'map')instead of the expectedError("Invalid chain data").Steps to Reproduce
stepsfield:{ "name": "sample chain" }3.Observe the thrown error.
Expected Behavior
The function should throw a controlled error:
Actual Behavior
The function throws a TypeError:
Environment
Vitest/ui v4.0.5
Vitest/coverage-v8 v4.0.4
Node.js v22.2.0
OS: Windows 11
File: src/lib/chain-service.ts
Test file: chain-service.test.ts
Screenshots
Additional Context
No response