Skip to content

Commit

Permalink
Make test data match new decoder output format
Browse files Browse the repository at this point in the history
  • Loading branch information
guilledk committed May 7, 2024
1 parent 4d60897 commit 0c2ccbe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/tests/testSerialization.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,14 @@ describe('bytefields encode/decode', () => {
const value = '0123456789abcdef0123456789abcdef01234567';
const encoded = encodeRowValue(tableName, fieldInfo, value);
const decoded = decodeRowValue(tableName, fieldInfo, encoded);
expect(decoded).to.be.equal(value);
expect(decoded).to.be.deep.equal(Buffer.from(value, 'hex'));
});

it('should encode and decode checksum256', () => {
const fieldInfo: ArrowTableMapping = {name: 'test_checksum256', type: 'checksum256'};
const value = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
const encoded = encodeRowValue(tableName, fieldInfo, value);
const decoded = decodeRowValue(tableName, fieldInfo, encoded);
expect(decoded).to.be.equal(value);
expect(decoded).to.be.deep.equal(Buffer.from(value, 'hex'));
});
});
12 changes: 6 additions & 6 deletions src/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ export const testDataContext: ArrowBatchContextDef = {
};


export type TestBlockRow = [bigint, bigint, string, number];
export type TestBlockRow = [bigint, bigint, Buffer | string, number];

export type TestTxRow = [string, bigint, bigint, number, number, Buffer];
export type TestTxRow = [string | Buffer, bigint, bigint, number, number, Buffer];

export type TestTxLogRow = [bigint, number, string];
export type TestTxLogRow = [bigint, number, string | Buffer];

export class TestChainGenerator {

Expand All @@ -66,7 +66,7 @@ export class TestChainGenerator {
return [
globalTxIdx,
logIndex,
randomHexString(40)
randomBytes(20)
];
}

Expand All @@ -77,7 +77,7 @@ export class TestChainGenerator {
evmOrdinal: number
): TestTxRow {
return [
randomHexString(64),
randomBytes(32),
globalTxIdx,
block,
actionOrdinal,
Expand All @@ -95,7 +95,7 @@ export class TestChainGenerator {
return [
num,
timestamp,
randomHexString(64),
randomBytes(32),
randomInteger(txAmountMin, txAmountMax)
]
}
Expand Down

0 comments on commit 0c2ccbe

Please sign in to comment.