wip
This commit is contained in:
parent
5a8c80e838
commit
59533a64d2
6 changed files with 85 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { bytesToUint256LittleEndian, uint256ToBytesLittleEndian } from "../subgraph"; // Adjust the import path to where your functions are defined
|
||||
import { bytesToUint256LittleEndian, uint256ToBytesLittleEndian } from "../subgraph";
|
||||
import { Position, PositionStatus } from '../__generated__/graphql';
|
||||
|
||||
|
||||
|
|
|
|||
42
harb-lib/src/tests/helpers.test.ts
Normal file
42
harb-lib/src/tests/helpers.test.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import { uint256ToBytesLittleEndian } from "../subgraph";
|
||||
import { getSnatchList } from "../helpers";
|
||||
import { Position, PositionStatus } from '../__generated__/graphql';
|
||||
|
||||
|
||||
describe('BigInt Conversion Functions', () => {
|
||||
test('get a list of positions to snatch', async () => {
|
||||
|
||||
const mockPos: Position[] = [
|
||||
{
|
||||
__typename: 'Position',
|
||||
id: uint256ToBytesLittleEndian(3n),
|
||||
owner: '0x8db6b632d743aef641146dc943acb64957155388',
|
||||
share: 0.000001,
|
||||
creationTime: 1610000000,
|
||||
taxRate: 0.05,
|
||||
status: PositionStatus.Active, // Enum usage
|
||||
},
|
||||
{
|
||||
__typename: 'Position',
|
||||
id: uint256ToBytesLittleEndian(4n),
|
||||
owner: '0x8db6b632d743aef641146dc943acb64957155388',
|
||||
share: 0.000001,
|
||||
creationTime: 1610000000,
|
||||
taxRate: 0.01,
|
||||
status: PositionStatus.Active, // Enum usage
|
||||
},
|
||||
{
|
||||
__typename: 'Position',
|
||||
id: uint256ToBytesLittleEndian(5n),
|
||||
owner: '0x8db6b632d743aef641146dc943acb64957155388',
|
||||
share: 0.000001,
|
||||
creationTime: 1610000000,
|
||||
taxRate: 0.02,
|
||||
status: PositionStatus.Active, // Enum usage
|
||||
}
|
||||
];
|
||||
|
||||
expect(getSnatchList(mockPos, 20000000000000000000n, 0.03)).toEqual([4n, 5n]);
|
||||
});
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue