Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
saadahmsiddiqui committed Oct 23, 2024
1 parent b8d9980 commit 2fd34d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions packages/substrate/src/__test__/fungible.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('SubstrateFungibleAssetTransfer', () => {
sourceNetworkProvider: api,
resource: '0x0000000000000000000000000000000000000000000000000000000000000300',
amount: BigInt(100),
destinationAddress: '0x98729c03c4D5e820F5e8c45558ae07aE63F97461',
recipientAddress: '0x98729c03c4D5e820F5e8c45558ae07aE63F97461',
environment: Environment.LOCAL,
};
});
Expand All @@ -43,16 +43,16 @@ describe('SubstrateFungibleAssetTransfer', () => {
test('should set constructor values', async () => {
const transfer = await createSubstrateFungibleAssetTransfer(transferRequest);

expect(transfer.amount).toBe(BigInt(100));
expect(transfer.transferAmount).toBe(BigInt(100));
expect(transfer.sourceNetworkProvider).toBe(transfer.sourceNetworkProvider);
expect(transfer.destinationAddress).toBe(transferRequest.destinationAddress);
expect(transfer.recipientAddress).toBe(transferRequest.recipientAddress);
});

test('should throw an error if destination address is Invalid', async () => {
const invalidDestinationAddress = 'someAddress';
const transfer = createSubstrateFungibleAssetTransfer({
...transferRequest,
destinationAddress: invalidDestinationAddress,
recipientAddress: invalidDestinationAddress,
});

await expect(() => transfer).rejects.toThrow('Invalid EVM Address');
Expand All @@ -63,7 +63,7 @@ describe('SubstrateFungibleAssetTransfer', () => {
test('should set another EVM destination address', async () => {
const transfer = await createSubstrateFungibleAssetTransfer(transferRequest);
transfer.setDestinationAddress('0x742d35Cc6634C0532925a3b844Bc454e4438f44e');
expect(transfer.destinationAddress).toBe('0x742d35Cc6634C0532925a3b844Bc454e4438f44e');
expect(transfer.recipientAddress).toBe('0x742d35Cc6634C0532925a3b844Bc454e4438f44e');
});

test('should not set an invalid destination address', async () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/utils/src/__test__/liquidity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const mockedTransferEVM = {
};

const mockedTransferSubstrate = {
amount: 0n,
transferAmount: 0n,
resource: mockedResource,
config: {
findDomainConfig: jest.fn(),
Expand Down Expand Up @@ -128,7 +128,7 @@ describe('hasEnoughLiquidity - substrate', () => {
});

it('should return true if there is enough liquidity', async () => {
mockedTransferSubstrate.amount = BigInt(5);
mockedTransferSubstrate.transferAmount = BigInt(5);

const isEnough = await hasEnoughLiquidity(
mockedTransferSubstrate as unknown as Awaited<ReturnType<typeof createFungibleAssetTransfer>>,
Expand All @@ -138,7 +138,7 @@ describe('hasEnoughLiquidity - substrate', () => {
expect(isEnough).toEqual(true);
});
it('should return false if there isnt enough liquidity', async () => {
mockedTransferSubstrate.amount = BigInt(10);
mockedTransferSubstrate.transferAmount = BigInt(10);

const isEnough = await hasEnoughLiquidity(
mockedTransferSubstrate as unknown as Awaited<ReturnType<typeof createFungibleAssetTransfer>>,
Expand Down

0 comments on commit 2fd34d2

Please sign in to comment.