additional test
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 37s Details

This commit is contained in:
Ladd Hoffman 2024-03-11 22:10:21 -05:00
parent 75a296553c
commit d8e4d4fd6a
1 changed files with 12 additions and 5 deletions

View File

@ -1,7 +1,6 @@
const {
time,
loadFixture,
// setPrevRandao,
} = require('@nomicfoundation/hardhat-toolbox/network-helpers');
const { expect } = require('chai');
const { ethers } = require('hardhat');
@ -98,7 +97,7 @@ describe('Work1', () => {
const {
dao, work1, account1, account2,
} = await loadFixture(deploy);
await dao.stakeAvailability(work1.target, 50, STAKE_DURATION, { from: account1 });
await dao.stakeAvailability(work1.target, 50, STAKE_DURATION);
const requestWork = () => work1.connect(account2).requestWork({ value: WORK1_PRICE });
await expect(requestWork()).to.emit(work1, 'WorkAssigned').withArgs(account1, 0);
expect(await work1.requestCount()).to.equal(1);
@ -114,11 +113,19 @@ describe('Work1', () => {
await expect(requestWork()).to.be.revertedWith('No available worker stakes');
});
it('should not be able to request work if fee is insufficient', async () => {
const {
work1, account2,
} = await loadFixture(deploy);
const requestWork = () => work1.connect(account2).requestWork({ value: WORK1_PRICE / 2 });
await expect(requestWork()).to.be.revertedWith('Insufficient fee');
});
it('should not assign work to an expired availability stake', async () => {
const {
dao, work1, account1, account2,
dao, work1, account2,
} = await loadFixture(deploy);
await dao.stakeAvailability(work1.target, 50, STAKE_DURATION, { from: account1 });
await dao.stakeAvailability(work1.target, 50, STAKE_DURATION);
const requestWork = () => work1.connect(account2).requestWork({ value: WORK1_PRICE });
await time.increase(61);
await expect(requestWork()).to.be.revertedWith('No available worker stakes');
@ -128,7 +135,7 @@ describe('Work1', () => {
const {
dao, work1, account1, account2,
} = await loadFixture(deploy);
await dao.stakeAvailability(work1.target, 50, STAKE_DURATION, { from: account1 });
await dao.stakeAvailability(work1.target, 50, STAKE_DURATION);
const requestWork = () => work1.connect(account2).requestWork({ value: WORK1_PRICE });
await expect(requestWork()).to.emit(work1, 'WorkAssigned').withArgs(account1, 0);
await expect(requestWork()).to.be.revertedWith('No available worker stakes');