Skip to content
This repository was archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
test: unit tests for swapexists (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
aorumbayev authored Dec 21, 2022
1 parent 353a030 commit 6dc0375
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/utils/api/swaps/swapExists.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { SwapConfiguration } from '@/models/Swap';
import swapExists from './swapExists';

describe(`swapExists`, () => {
it(`should return true if there is at least one swap configuration with the specified escrow address`, () => {
const swapConfigs = [
{ escrow: `0x123` },
{ escrow: `0x456` },
] as SwapConfiguration[];
expect(swapExists(`0x123`, swapConfigs)).toBe(true);
});

it(`should return false if there are no swap configurations with the specified escrow address`, () => {
const swapConfigs = [
{ escrow: `0x123` },
{ escrow: `0x456` },
] as SwapConfiguration[];
expect(swapExists(`0x789`, swapConfigs)).toBe(false);
});
});

1 comment on commit 6dc0375

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for algoworld-swapper ready!

✅ Preview
https://algoworld-swapper-au3x008ro-algoworldexplorer.vercel.app

Built with commit 6dc0375.
This pull request is being automatically deployed with vercel-action

Please # to comment.