Commit 26e6a97
Add comprehensive unit tests for Chain Cast (#17)
* Working
* Merge pull request #12 from layerx-labs/hcv_migration_to_bun
Migration to Bun Runtime
* Replace dappkit and ethers with viem (#13)
* Bun Runtime
* ChainCast
* ci
* ci-cd
* Opus is a beast 😱
* [TKAI-4349] create a webhook to send swap events tkai bepro to zapier (#14)
* chore: add missing dependency
* feat: add json parse instruction
* refactor: fix template args
* refactor: add lib to convert bigint to string on objects
* refactor: undo change
* chore: remove web3
* refactor: use viem instead of web3
* feat: improve VM error logging with context and backtrace
Add detailed error and halt logging to the Virtual Machine with:
- Cast ID, event name, and block number context
- Instruction that caused the halt/error
- Full backtrace of executed instructions with args
- Differentiation between errors and intentional halts
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Vitor Hugo <vhcsilva@gmail.com>
Co-authored-by: Helder Vasconcelos <heldervasc@bearstouch.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* Fix CI: upgrade setup-bun to v2 and codecov-action to v5
- setup-bun v1 has caching bugs causing HTTP 400 errors
- codecov-action v5 is the latest stable version
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Upload
* Add unit tests for mocks, utilities, and instructions
- Add mock utilities for Prisma, viem client, external services, and logging
- Add test fixtures for events, casts, and programs
- Add unit tests for utility functions (getVariableFromPath)
- Add unit tests for core library (Stack, ChainCastProgram, ChainCastVirtualMachine)
- Add unit tests for all 13 instruction plugins:
- debug, set, filter-events, condition
- transform-string, transform-number, transform-array, transform-object, transform-template
- webhook, bullmq, elasticsearch, spreadsheet
Tests: 286 passing
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Add test scripts and CI/CD test execution
- Add test:watch script for continuous test running during development
- Add test:debug script with --inspect-brk for debugging tests
- Update CI/CD pipeline to run tests after build
- Add coverage reporting to Codecov (no threshold enforcement)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Add service tests for ChainCastSecretManager
- Add comprehensive tests for secret manager CRUD operations
- Test addSecrets, addSecret, deleteSecret, updateSecret, getSecret, getSecrets
- Add integration scenario tests for typical cast workflows
Tests: 302 passing
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Add contract cast, listener, retriever, manager and GraphQL resolver tests
- Create contract-cast.test.ts with tests for EVMContractCast
- Constructor, getters, loadSecrets, loadProgram
- Status management, onEvent handling
- Event recovery progress tracking
- Create contract-listener.test.ts with tests for EVMContractListener
- Event extraction from ABI, startListening/stopListening
- Handler management and connection callbacks
- Create contract-event-retriever.test.ts with tests for EVMContractEventRetriever
- Batch event fetching and recovery
- Progress reporting and stop condition handling
- Event format conversion (viem to Web3Event)
- Create chaincast-manager.test.ts with tests for ChainCastManager
- Instruction registration
- Cast lifecycle management (start, stop, add, delete, restart)
- Database integration
- Create GraphQL resolver tests
- contract-cast.test.ts: contractCast query, CRUD mutations
- secret.test.ts: create, update, delete secret mutations
Total: 410 tests passing, 86.05% line coverage
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Fixed
* Fix program tests for cross-platform compatibility
Move Zod schemas outside mock classes and use explicit constructors
to ensure proper initialization order across different Bun environments
(macOS vs Linux).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Fix program tests: use actual instruction classes
Replace mock instruction classes with actual Debug and Set instruction
classes from the codebase to ensure cross-platform compatibility.
The mock classes had constructor/property initialization issues that
caused different behavior on Linux vs macOS in Bun.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Fix cross-platform base64 encoding in program tests
- Replace btoa() with Buffer.from().toString('base64') in tests
- Change toString('ascii') to toString('utf-8') in program decoder
- Add encodeInstructions() helper for consistent encoding
The btoa/ascii combination behaved inconsistently between macOS and
Linux in GitHub Actions. Using Buffer with utf-8 encoding ensures
reliable cross-platform behavior.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fixed
---------
Co-authored-by: Vitor Hugo <9003126+vhcsilva@users.noreply.github.com>
Co-authored-by: Vitor Hugo <vhcsilva@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent fbc4cd6 commit 26e6a97
File tree
36 files changed
+7521
-4
lines changed- .github/workflows
- src
- __tests__
- __mocks__
- fixtures
- graphql/resolvers
- instructions
- lib
- services
- util
- lib
- util
36 files changed
+7521
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
35 | 46 | | |
36 | 47 | | |
37 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
0 commit comments