Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated baker account for staking tests #2951

Merged
merged 2 commits into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions integration-tests/__tests__/contract/operations/staking.spec.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
import { CONFIGS } from "../../../config";
import { Protocols } from '@taquito/taquito';
import { ProtoGreaterOrEqual } from '@taquito/michel-codec';

CONFIGS().forEach(({ lib, rpc, setup }) => {
CONFIGS().forEach(({ lib, rpc, setup, knownBaker, protocol }) => {
const Tezos = lib;
const parisAndAlpha = ProtoGreaterOrEqual(protocol, Protocols.PtParisBQ) ? test : test.skip;

describe(`Staking pseudo operations: ${rpc}`, () => {

beforeAll(async () => {
await setup(true);

const delegateOp = await Tezos.contract.setDelegate({
delegate: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA',
delegate: knownBaker,
source: await Tezos.signer.publicKeyHash()
});

await delegateOp.confirmation();
});

it('should throw an error when the destination specified is not the same as source', async () => {
parisAndAlpha('should throw an error when the destination specified is not the same as source', async () => {
expect(async () => {
const op = await Tezos.contract.stake({
amount: 0.1,
to: 'tz1PZY3tEWmXGasYeehXYqwXuw2Z3iZ6QDnA'
to: knownBaker
});
}).rejects.toThrow();
});

it('should be able to stake funds to a designated delegate', async () => {
parisAndAlpha('should be able to stake funds to a designated delegate', async () => {
const op = await Tezos.contract.stake({
amount: 0.1
});
Expand All @@ -35,7 +38,7 @@ CONFIGS().forEach(({ lib, rpc, setup }) => {
expect(op.status).toEqual('applied');
});

it('should be able to unstake funds from a designated delegate', async () => {
parisAndAlpha('should be able to unstake funds from a designated delegate', async () => {
const op = await Tezos.contract.unstake({
amount: 0.1
});
Expand All @@ -45,7 +48,7 @@ CONFIGS().forEach(({ lib, rpc, setup }) => {
expect(op.status).toEqual('applied');
});

it('should be able to finalize_unstake funds from a designated delegate', async () => {
parisAndAlpha('should be able to finalize_unstake funds from a designated delegate', async () => {
const op = await Tezos.contract.finalizeUnstake({});
await op.confirmation();

Expand Down
Loading