slight test refactor
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 34s Details

This commit is contained in:
Ladd Hoffman 2024-03-11 15:42:14 -05:00
parent bb9355db15
commit 75a296553c
1 changed files with 12 additions and 28 deletions

View File

@ -136,49 +136,41 @@ describe('Work1', () => {
});
describe('Work evidence and approval/disapproval', () => {
let dao;
let work1;
let account2;
beforeEach(async () => {
const setup = await loadFixture(deploy);
dao = setup.dao;
work1 = setup.work1;
account2 = setup.account2;
await dao.stakeAvailability(work1.target, 50, STAKE_DURATION);
});
it('should be able to submit work evidence', async () => {
const {
dao, work1, account1, account2,
} = await loadFixture(deploy);
await dao.stakeAvailability(work1.target, 50, STAKE_DURATION, { from: account1 });
await work1.connect(account2).requestWork({ value: WORK1_PRICE });
await expect(work1.submitWorkEvidence(0)).to.emit(work1, 'WorkEvidenceSubmitted').withArgs(0);
});
it('should not be able to submit work evidence twice', async () => {
const {
dao, work1, account1, account2,
} = await loadFixture(deploy);
await dao.stakeAvailability(work1.target, 50, STAKE_DURATION, { from: account1 });
await work1.connect(account2).requestWork({ value: WORK1_PRICE });
await expect(work1.submitWorkEvidence(0)).to.emit(work1, 'WorkEvidenceSubmitted').withArgs(0);
await expect(work1.submitWorkEvidence(0)).to.be.revertedWith('Status must be Requested');
});
it('should not be able to submit work evidence for a different worker', async () => {
const {
dao, work1, account1, account2,
} = await loadFixture(deploy);
await dao.stakeAvailability(work1.target, 50, STAKE_DURATION, { from: account1 });
await work1.connect(account2).requestWork({ value: WORK1_PRICE });
await expect(work1.connect(account2).submitWorkEvidence(0)).to.be.revertedWith('Worker can only submit evidence for work they are assigned');
});
it('should be able to submit work approval', async () => {
const {
dao, work1, account1, account2,
} = await loadFixture(deploy);
await dao.stakeAvailability(work1.target, 50, STAKE_DURATION, { from: account1 });
await work1.connect(account2).requestWork({ value: WORK1_PRICE });
await work1.submitWorkEvidence(0);
await expect(work1.submitWorkApproval(0, true)).to.emit(dao, 'ValidationPoolInitiated').withArgs(1);
});
it('should not be able to submit work approval/disapproval twice', async () => {
const {
dao, work1, account1, account2,
} = await loadFixture(deploy);
await dao.stakeAvailability(work1.target, 50, STAKE_DURATION, { from: account1 });
await work1.connect(account2).requestWork({ value: WORK1_PRICE });
await work1.submitWorkEvidence(0);
await expect(work1.submitWorkApproval(0, true)).to.emit(dao, 'ValidationPoolInitiated').withArgs(1);
@ -186,10 +178,6 @@ describe('Work1', () => {
});
it('should not be able to submit work evidence after work approval', async () => {
const {
dao, work1, account1, account2,
} = await loadFixture(deploy);
await dao.stakeAvailability(work1.target, 50, STAKE_DURATION, { from: account1 });
await work1.connect(account2).requestWork({ value: WORK1_PRICE });
await work1.submitWorkEvidence(0);
await expect(work1.submitWorkApproval(0, true)).to.emit(dao, 'ValidationPoolInitiated').withArgs(1);
@ -197,10 +185,6 @@ describe('Work1', () => {
});
it('should not be able to submit work approval/disapproval before work evidence', async () => {
const {
dao, work1, account1, account2,
} = await loadFixture(deploy);
await dao.stakeAvailability(work1.target, 50, STAKE_DURATION, { from: account1 });
await work1.connect(account2).requestWork({ value: WORK1_PRICE });
await expect(work1.submitWorkApproval(0, true)).to.be.revertedWith('Status must be EvidenceSubmitted');
});