-
Notifications
You must be signed in to change notification settings - Fork 14
Migrate IexecAccessors tests Typescript & Hardhat #96
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
da27351
Rename file to ts
zguesmi f1220cc
Deploy RLC using factory
zguesmi 502714b
Disable repetitive log message
zguesmi 72a76d5
Migrate IexecAccessors to TS and Hardhat
zguesmi b08822e
Clean
zguesmi dc10c03
Merge branch 'develop' into feature/test-migration-1
zguesmi 9be1b3c
Revert "Deploy RLC using factory"
zguesmi 997750b
Fix tests
zguesmi 4979c96
Update changelog
zguesmi bf8302c
Update test/byContract/IexecAccessors/IexecAccessors.ts
zguesmi 1a63fc0
Update test/byContract/IexecAccessors/IexecAccessors.ts
zguesmi 7d814b0
Keep only pocoAsAnyone instance
zguesmi d5afde9
Reorder tests according to source file functions order
zguesmi 9386532
Add todo
zguesmi ac3f9a0
Update test/byContract/IexecAccessors/IexecAccessors.ts
zguesmi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
// SPDX-FileCopyrightText: 2020-2024 IEXEC BLOCKCHAIN TECH <contact@iex.ec> | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers'; | ||
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; | ||
import { deployments, ethers, expect } from 'hardhat'; | ||
import { loadHardhatFixtureDeployment } from '../../../scripts/hardhat-fixture-deployer'; | ||
import { IexecInterfaceNative, IexecInterfaceNative__factory } from '../../../typechain'; | ||
import { getIexecAccounts } from '../../../utils/poco-tools'; | ||
|
||
/** | ||
* Test state view functions. | ||
*/ | ||
describe('IexecAccessors', async () => { | ||
let proxyAddress: string; | ||
let iexecPocoAsAnyone: IexecInterfaceNative; | ||
let anyone: SignerWithAddress; | ||
|
||
beforeEach('Deploy', async () => { | ||
// Deploy all contracts | ||
proxyAddress = await loadHardhatFixtureDeployment(); | ||
// Initialize test environment | ||
await loadFixture(initFixture); | ||
}); | ||
|
||
async function initFixture() { | ||
const accounts = await getIexecAccounts(); | ||
({ anyone } = accounts); | ||
iexecPocoAsAnyone = IexecInterfaceNative__factory.connect(proxyAddress, anyone); | ||
} | ||
|
||
it('name', async function () { | ||
expect(await iexecPocoAsAnyone.name()).to.equal('Staked RLC'); | ||
}); | ||
it('symbol', async function () { | ||
expect(await iexecPocoAsAnyone.symbol()).to.equal('SRLC'); | ||
}); | ||
it('decimals', async function () { | ||
expect(await iexecPocoAsAnyone.decimals()).to.equal(9n); | ||
}); | ||
it('totalSupply', async function () { | ||
expect(await iexecPocoAsAnyone.totalSupply()).to.equal(0n); | ||
}); | ||
// TODO test the case where token() == 0x0 in native mode. | ||
it('token', async function () { | ||
expect(await iexecPocoAsAnyone.token()).to.equal( | ||
'0x5FbDB2315678afecb367f032d93F642f64180aa3', | ||
); | ||
}); | ||
it('countCategory', async function () { | ||
expect(await iexecPocoAsAnyone.countCategory()).to.equal(5); | ||
}); | ||
it('appRegistry', async function () { | ||
expect(await iexecPocoAsAnyone.appregistry()).to.equal( | ||
(await deployments.get('AppRegistry')).address, | ||
); | ||
}); | ||
it('datasetRegistry', async function () { | ||
expect(await iexecPocoAsAnyone.datasetregistry()).to.equal( | ||
(await deployments.get('DatasetRegistry')).address, | ||
); | ||
}); | ||
it('workerpoolRegistry', async function () { | ||
expect(await iexecPocoAsAnyone.workerpoolregistry()).to.equal( | ||
(await deployments.get('WorkerpoolRegistry')).address, | ||
); | ||
}); | ||
it('teeBroker', async function () { | ||
expect(await iexecPocoAsAnyone.teebroker()).to.equal(ethers.constants.AddressZero); | ||
}); | ||
it('callbackGas', async function () { | ||
expect(await iexecPocoAsAnyone.callbackgas()).to.equal(100_000n); | ||
}); | ||
it('contributionDeadlineRatio', async function () { | ||
expect(await iexecPocoAsAnyone.contribution_deadline_ratio()).to.equal(7); | ||
}); | ||
it('revealDeadlineRatio', async function () { | ||
expect(await iexecPocoAsAnyone.reveal_deadline_ratio()).to.equal(2n); | ||
}); | ||
it('finalDeadlineRatio', async function () { | ||
expect(await iexecPocoAsAnyone.final_deadline_ratio()).to.equal(10n); | ||
}); | ||
it('workerpoolStakeRatio', async function () { | ||
expect(await iexecPocoAsAnyone.workerpool_stake_ratio()).to.equal(30n); | ||
}); | ||
it('kittyRatio', async function () { | ||
expect(await iexecPocoAsAnyone.kitty_ratio()).to.equal(10n); | ||
}); | ||
it('kittyMin', async function () { | ||
expect(await iexecPocoAsAnyone.kitty_min()).to.equal(1_000_000_000n); | ||
}); | ||
it('kittyAddress', async function () { | ||
expect(await iexecPocoAsAnyone.kitty_address()).to.equal( | ||
'0x99c2268479b93fDe36232351229815DF80837e23', | ||
); | ||
}); | ||
it('groupMemberPurpose', async function () { | ||
expect(await iexecPocoAsAnyone.groupmember_purpose()).to.equal(4n); | ||
}); | ||
it('eip712domainSeparator', async function () { | ||
expect(await iexecPocoAsAnyone.eip712domain_separator()).to.equal( | ||
'0xfc2178d8b8300e657cb9f8b5a4d1957174cf1392e294f3575b82a9cea1da1c4b', | ||
); | ||
}); | ||
}); | ||
james-toussaint marked this conversation as resolved.
Show resolved
Hide resolved
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.