Skip to content

Commit

Permalink
Fix pool.setAssetDetails unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shark0der committed Jan 26, 2023
1 parent 606956c commit 778a313
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions test/unit/Pool/setAssetDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,28 @@ describe('setAssetDetails', function () {
).to.be.revertedWith('Pool: Asset does not exist');
});

// TODO: revise test below
it('marks asset as cover asset, or abandoned', async function () {
const { pool } = this;
const [governance] = this.accounts.governanceContracts;
const pool = this.pool.connect(governance);

const assets = await pool.getAssets();
const lastAssetId = assets.length - 1;

await pool.connect(governance).setAssetDetails(lastAssetId, false, false);
await pool.setAssetDetails(lastAssetId, false, false);
expect((await pool.getAsset(lastAssetId)).isCoverAsset).to.be.equal(false);
expect((await pool.getAsset(lastAssetId)).isAbandoned).to.be.equal(false);

await pool.setAssetDetails(lastAssetId, true, false);
expect((await pool.getAsset(lastAssetId)).isCoverAsset).to.be.equal(true);
expect((await pool.getAsset(lastAssetId)).isAbandoned).to.be.equal(false);

await pool.setAssetDetails(lastAssetId, false, true);
expect((await pool.getAsset(lastAssetId)).isCoverAsset).to.be.equal(false);
expect((await pool.getAsset(lastAssetId)).isAbandoned).to.be.equal(true);

await pool.setAssetDetails(lastAssetId, true, true);
expect((await pool.getAsset(lastAssetId)).isCoverAsset).to.be.equal(true);
expect((await pool.getAsset(lastAssetId)).isAbandoned).to.be.equal(true);

await expect(
pool.connect(governance).setAssetDetails(lastAssetId + 1, false, false), // assetId out of bounds
Expand Down

0 comments on commit 778a313

Please sign in to comment.