Skip to content

Commit

Permalink
fix e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenVoich committed Feb 26, 2024
1 parent 60f2a97 commit 102ddc6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion initArgs.local.did
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
btcFlowerGen2 = 50000000; // 0.5 SEED
};
stakePeriod = variant { seconds = 15 };
rewardInterval = variant { seconds = 7 };
rewardInterval = variant { seconds = 10 };
trilogyBonus = 15; // 15%
}
)
26 changes: 15 additions & 11 deletions test/stake.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,20 @@ describe('staking', () => {
test('stake 3 flowers', async () => {
expect((await agent.mainActor.getCallerUser()).neurons).toHaveLength(0);

let res1 = await agent.mainActor.stake(btcStakeFlower);
expect(res1).toHaveProperty('ok');
expect((await agent.mainActor.getCallerUser()).neurons).toHaveLength(1);

let res2 = await agent.mainActor.stake(ethStakeFlower);
expect(res2).toHaveProperty('ok');
expect((await agent.mainActor.getCallerUser()).neurons).toHaveLength(2);

let res3 = await agent.mainActor.stake(icpStakeFlower);
expect(res3).toHaveProperty('ok');
await Promise.all([
(async () => {
let res1 = await agent.mainActor.stake(btcStakeFlower);
expect(res1).toHaveProperty('ok');
})(),
(async () => {
let res2 = await agent.mainActor.stake(ethStakeFlower);
expect(res2).toHaveProperty('ok');
})(),
(async () => {
let res3 = await agent.mainActor.stake(icpStakeFlower);
expect(res3).toHaveProperty('ok');
})(),
]);
let user = await agent.mainActor.getCallerUser();
let neurons = user.neurons;

Expand All @@ -130,7 +134,7 @@ describe('staking', () => {
});

test('wait for rewards', async () => {
await new Promise(resolve => setTimeout(resolve, 1000 * 7));
await new Promise(resolve => setTimeout(resolve, 1000 * 10));
});

test('check rewards', async () => {
Expand Down

0 comments on commit 102ddc6

Please sign in to comment.