Skip to content

Commit 30e3682

Browse files
pcarranzavclaude
andauthored
fix: tests in the horizon branch (#1135)
Co-authored-by: Claude <[email protected]>
1 parent 19a4df1 commit 30e3682

File tree

13 files changed

+285
-199
lines changed

13 files changed

+285
-199
lines changed

packages/indexer-cli/jest.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ module.exports = {
1313
// The glob patterns Jest uses to detect test files
1414
testMatch: ['**/?(*.)+(spec|test).ts?(x)'],
1515
testPathIgnorePatterns: ['/node_modules/', '/dist/', '.yalc'],
16-
transformIgnorePatterns: ['!node_modules/'],
1716
testTimeout: 60000,
1817
globals: {
1918
__DATABASE__: {
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
┌────┬──────────────────┬────────────┬────────────────────────────────────────────────┬──────────────┬────────┬──────┬───────┬──────────┬───────┬────────┬───────────────┬─────────────┬────────┐
2-
│ id │ protocolNetwork │ type │ deploymentID │ allocationID │ amount │ poi │ force │ priority │ status │ source │ failureReason │ transaction │ reason │
3-
├────┼──────────────────┼────────────┼────────────────────────────────────────────────┼──────────────┼────────┼──────┼───────┼──────────┼───────┼────────┼───────────────┼─────────────┼────────┤
4-
│ 2 │ arbitrum-sepolia │ unallocate │ QmSrf6VVPyg9NGdS1xhLmoosk3qZQaWhfoSTHE2H7sht6Q │ null │ null │ null │ null 0 │ failed │ test │ null │ null │ test │
5-
└────┴──────────────────┴────────────┴────────────────────────────────────────────────┴──────────────┴────────┴──────┴───────┴──────────┴───────┴────────┴───────────────┴─────────────┴────────┘
1+
┌────┬──────────────────┬────────────┬────────────────────────────────────────────────┬──────────────┬────────┬──────┬───────────┬────────────────┬───────┬──────────┬────────┬───────────────────────┬─────────────┬────────┬──────────┐
2+
│ id │ protocolNetwork │ type │ deploymentID │ allocationID │ amount │ poi │ publicPOI │ poiBlockNumber │ force │ priority │ status │ source │ failureReason │ transaction │ reason │ isLegacy
3+
├────┼──────────────────┼────────────┼────────────────────────────────────────────────┼──────────────┼────────┼──────┼───────────┼────────────────┼───────┼──────────┼────────┼───────────────────────┼─────────────┼────────┼──────────┤
4+
│ 2 │ arbitrum-sepolia │ unallocate │ QmSrf6VVPyg9NGdS1xhLmoosk3qZQaWhfoSTHE2H7sht6Q │ null │ null │ null │ null │ null │ null │ 0 │ failed │ test │ null │ null │ test │ false
5+
└────┴──────────────────┴────────────┴────────────────────────────────────────────────┴──────────────┴────────┴──────┴───────────┴────────────────┴───────┴──────────┴────────┴───────────────────────┴─────────────┴────────┴──────────┘
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
┌────┬──────────────────┬────────────┬────────────────────────────────────────────────┬──────────────┬────────┬──────┬───────┬──────────┬─────────┬────────┬───────────────┬─────────────┬────────┐
2-
│ id │ protocolNetwork │ type │ deploymentID │ allocationID │ amount │ poi │ force │ priority │ status │ source │ failureReason │ transaction │ reason │
3-
├────┼──────────────────┼────────────┼────────────────────────────────────────────────┼──────────────┼────────┼──────┼───────┼──────────┼─────────┼────────┼───────────────┼─────────────┼────────┤
4-
│ 2 │ arbitrum-sepolia │ unallocate │ QmSrf6VVPyg9NGdS1xhLmoosk3qZQaWhfoSTHE2H7sht6Q │ null │ null │ null │ null 0 │ failed │ test │ null │ null │ test │
5-
├────┼──────────────────┼────────────┼────────────────────────────────────────────────┼──────────────┼────────┼──────┼───────┼──────────┼─────────┼────────┼───────────────┼─────────────┼────────┤
6-
│ 1 │ arbitrum-sepolia │ allocate │ QmSrf6VVPyg9NGdS1xhLmoosk3qZQaWhfoSTHE2H7sht6Q │ null │ null │ null │ null 0 │ success │ test │ null │ null │ test │
7-
└────┴──────────────────┴────────────┴────────────────────────────────────────────────┴──────────────┴────────┴──────┴───────┴──────────┴─────────┴────────┴───────────────┴─────────────┴────────┘
1+
┌────┬──────────────────┬────────────┬────────────────────────────────────────────────┬──────────────┬────────┬──────┬───────────┬────────────────┬───────┬──────────┬────────┬───────────────────────┬─────────────┬────────┬──────────┐
2+
│ id │ protocolNetwork │ type │ deploymentID │ allocationID │ amount │ poi │ publicPOI │ poiBlockNumber │ force │ priority │ status │ source │ failureReason │ transaction │ reason │ isLegacy
3+
├────┼──────────────────┼────────────┼────────────────────────────────────────────────┼──────────────┼────────┼──────┼───────────┼────────────────┼───────┼──────────┼────────┼───────────────────────┼─────────────┼────────┼──────────┤
4+
│ 2 │ arbitrum-sepolia │ unallocate │ QmSrf6VVPyg9NGdS1xhLmoosk3qZQaWhfoSTHE2H7sht6Q │ null │ null │ null │ null │ null │ null │ 0 │ failed │ test │ null │ null │ test │ false
5+
├────┼──────────────────┼────────────┼────────────────────────────────────────────────┼──────────────┼────────┼──────┼───────────┼────────────────┼───────┼──────────┼────────┼───────────────────────┼─────────────┼────────┼──────────┤
6+
│ 1 │ arbitrum-sepolia │ allocate │ QmSrf6VVPyg9NGdS1xhLmoosk3qZQaWhfoSTHE2H7sht6Q │ null │ null │ null │ null │ null │ null │ 0 │ success │ test │ null │ null │ test │ false
7+
└────┴──────────────────┴────────────┴────────────────────────────────────────────────┴──────────────┴────────┴──────┴───────────┴────────────────┴───────┴──────────┴────────┴───────────────────────┴─────────────┴────────┴──────────┘
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
Error: Indexing rule attribute 'allocationAmoewt' not supported, did you mean?
2-
- allocationAmount
3-
- allocationLifetime
4-
- maxAllocationPercentage
1+
Error: allocationAmoewt

packages/indexer-cli/src/__tests__/util.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { Socket } from 'net'
55
import { URL } from 'url'
66
import path from 'path'
77
import { Sequelize } from 'sequelize'
8-
import stripAnsi from 'strip-ansi'
98
import {
109
ActionStatus,
1110
ActionType,
@@ -56,6 +55,22 @@ let metrics: Metrics
5655
const yamlObj = loadTestYamlConfig()
5756
const testNetworkSpecification = specification.NetworkSpecification.parse(yamlObj)
5857

58+
// Replace strip-ansi with a simple function using the same regex pattern
59+
// Based on ansi-regex v6.1.0 pattern
60+
function stripAnsi(str: string): string {
61+
if (typeof str !== 'string') {
62+
throw new TypeError(`Expected a string, got ${typeof str}`)
63+
}
64+
65+
// Regex pattern from ansi-regex
66+
const pattern = [
67+
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))',
68+
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
69+
].join('|')
70+
71+
return str.replace(new RegExp(pattern, 'g'), '')
72+
}
73+
5974
export const setupMultiNetworks = async () => {
6075
return await setup(true)
6176
}
@@ -279,6 +294,7 @@ export const seedActions = async () => {
279294
source: 'test',
280295
reason: 'test',
281296
protocolNetwork: 'eip155:421614',
297+
isLegacy: false,
282298
})
283299
await models.Action.create({
284300
id: 2,
@@ -288,6 +304,7 @@ export const seedActions = async () => {
288304
source: 'test',
289305
reason: 'test',
290306
protocolNetwork: 'eip155:421614',
307+
isLegacy: false,
291308
})
292309
} catch (e) {
293310
logger.error('Failed to seed ', { error: e })

packages/indexer-common/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
"dependencies": {
2525
"@pinax/graph-networks-registry": "0.6.7",
2626
"@graphprotocol/common-ts": "3.0.1",
27+
"@graphprotocol/horizon": "0.4.1",
28+
"@graphprotocol/subgraph-service": "0.4.1",
2729
"@graphprotocol/toolshed": "0.6.5",
2830
"@semiotic-labs/tap-contracts-bindings": "2.0.0",
2931
"@thi.ng/heaps": "1.2.38",

0 commit comments

Comments
 (0)