fix: kraiken-lib: fix broken tests + raise coverage to 95% (#286)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2aa85f5a03
commit
dc95b2d22e
23 changed files with 8 additions and 3177 deletions
|
|
@ -2,17 +2,9 @@ import { describe, expect, test } from 'vitest';
|
|||
import { bytesToUint256LittleEndian, uint256ToBytesLittleEndian } from '../subgraph.js';
|
||||
|
||||
describe('BigInt Conversion Functions', () => {
|
||||
test('converts uint256 to bytes and back (little endian)', async () => {
|
||||
test('converts uint256 to bytes and back (little endian)', () => {
|
||||
const mockId = uint256ToBytesLittleEndian(3n);
|
||||
let hexString = '0x';
|
||||
|
||||
for (let i = 0; i < mockId.length; i++) {
|
||||
// Convert each byte to a hexadecimal string and pad with zero if needed
|
||||
hexString += mockId[i].toString(16).padStart(2, '0');
|
||||
}
|
||||
expect(hexString).toEqual('0x03000000');
|
||||
|
||||
// return hexString;
|
||||
expect(mockId).toEqual(new Uint8Array([3, 0, 0, 0]));
|
||||
expect(bytesToUint256LittleEndian(mockId)).toEqual(3n);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue