Skip to content

Commit

Permalink
test: reserve token before tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeday committed Dec 4, 2023
1 parent 0950691 commit 3104c8e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
13 changes: 11 additions & 2 deletions packages/sdk/src/erc20/__tests__/steth-wallet.test.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
import { describe } from '@jest/globals';
import { beforeAll, describe } from '@jest/globals';
import { LidoSDKstETH } from '../steth.js';
import {
useRpcCore,
useWeb3Core,
} from '../../../tests/utils/fixtures/use-core.js';
import { expectERC20Wallet } from '../../../tests/utils/expect/expect-erc20-wallet.js';
import { LIDO_CONTRACT_NAMES } from '../../index.js';
import { useStake } from '../../../tests/utils/fixtures/use-stake.js';
import { useTestsEnvs } from '../../../tests/utils/fixtures/use-test-envs.js';
import { SPENDING_TIMEOUT } from '../../../tests/utils/test-spending.js';

describe('LidoSDKStake', () => {
describe('LidoSDKstETH', () => {
const rpcCore = useRpcCore();
const web3Core = useWeb3Core();
const stake = useStake();
const { skipSpendingTests } = useTestsEnvs();

const constructedWithRpcCore = new LidoSDKstETH({ core: rpcCore });
const constructedWithWeb3Core = new LidoSDKstETH({ core: web3Core });

beforeAll(async () => {
if (!skipSpendingTests) await stake.stakeEth({ value: 500n });
}, SPENDING_TIMEOUT);

expectERC20Wallet({
contractName: LIDO_CONTRACT_NAMES.lido,
constructedWithRpcCore,
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/erc20/__tests__/steth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { expectERC20 } from '../../../tests/utils/expect/expect-erc20.js';
import { LIDO_CONTRACT_NAMES } from '../../index.js';

describe('LidoSDKStake', () => {
describe('LidoSDKstETH', () => {
const rpcCore = useRpcCore();
const web3Core = useWeb3Core();

Expand Down
13 changes: 11 additions & 2 deletions packages/sdk/src/erc20/__tests__/wsteth-wallet.test.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
import { describe } from '@jest/globals';
import { beforeAll, describe } from '@jest/globals';
import { LidoSDKwstETH } from '../wsteth.js';
import {
useRpcCore,
useWeb3Core,
} from '../../../tests/utils/fixtures/use-core.js';
import { expectERC20Wallet } from '../../../tests/utils/expect/expect-erc20-wallet.js';
import { LIDO_CONTRACT_NAMES } from '../../index.js';
import { SPENDING_TIMEOUT } from '../../../tests/utils/test-spending.js';
import { useWrap } from '../../../tests/utils/fixtures/use-wrap.js';
import { useTestsEnvs } from '../../../tests/utils/fixtures/use-test-envs.js';

describe('LidoSDKStake', () => {
describe('LidoSDKwstETH', () => {
const rpcCore = useRpcCore();
const web3Core = useWeb3Core();
const wrap = useWrap();
const { skipSpendingTests } = useTestsEnvs();

const constructedWithRpcCore = new LidoSDKwstETH({ core: rpcCore });
const constructedWithWeb3Core = new LidoSDKwstETH({ core: web3Core });

beforeAll(async () => {
if (!skipSpendingTests) await wrap.wrapEth({ value: 600n });
}, SPENDING_TIMEOUT);

expectERC20Wallet({
contractName: LIDO_CONTRACT_NAMES.wsteth,
constructedWithRpcCore,
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/erc20/__tests__/wsteth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { expectERC20 } from '../../../tests/utils/expect/expect-erc20.js';
import { LIDO_CONTRACT_NAMES } from '../../index.js';

describe('LidoSDKStake', () => {
describe('LidoSDKWsteth', () => {
const rpcCore = useRpcCore();
const web3Core = useWeb3Core();

Expand Down

0 comments on commit 3104c8e

Please sign in to comment.