import { bytesToUint256LittleEndian, uint256ToBytesLittleEndian } from "../subgraph"; // Adjust the import path to where your functions are defined import { Position, PositionStatus } from '../__generated__/graphql'; describe('BigInt Conversion Functions', () => { test('converts uint256 to bytes and back (little endian)', async () => { const mockPos: Position = { __typename: 'Position', id: uint256ToBytesLittleEndian(3n), owner: '0x8db6b632d743aef641146dc943acb64957155388', share: '0.000001', creationTime: 1610000000, taxRate: '0.01', status: PositionStatus.Active, // Enum usage }; let hexString = '0x'; for (let i = 0; i < mockPos.id.length; i++) { // Convert each byte to a hexadecimal string and pad with zero if needed hexString += mockPos.id[i].toString(16).padStart(2, '0'); } expect(hexString).toEqual('0x03000000'); // return hexString; expect(bytesToUint256LittleEndian(mockPos.id)).toEqual(3n); }); });