Skip to content

Commit

Permalink
CU-1u5ykup - add generated types and refactor, add eth sign to crowdl…
Browse files Browse the repository at this point in the history
…oan tests, bonded finance tests implementation (#487)

* add generated types and refactor tests, add eth sign to crowdloan

* Pulling bondPrice for bondedFinance Tests from variable

* test(bondedFinance TX Tests, Added mocha config file, Cleanup.):

(txBondedFinanceTests.ts): bondedFinance Extrinsic test
implementation.
(BondedFinance Pallet): MinReward now exposed through a
constant query.
(queryCrowdloanRewardsTests.ts): Updated checks and
timeout.

Following files have been removed, due to problems with the
new type implementation.
(queryTokenTests.ts): Removed Query Token Tests
(Partial stub and stopped working)
(querySystemAccountTests.ts): Removed
Query System Account Tests (Stopped working)

Added .mocharc.json configuration file.
Cleanup

Signed-off-by: Dominik Roth <dominik@composable.finance>

* test(bondedFinance TX Tests, bondedFinance pallet, Runtime Tests ReadMe):

(txBondedFinanceTests.ts): Moved test handlers into a folder to reduce
the file length. Also added additional tests.

(BondedFinance Pallet):
In cancel function, set keep-alive of second Transfer function to false.
Since clears the wallet of the staking account, and wasn't working
therefore.

(README.md): Changed timeout example to not show an infinite
timeout. Added run information for the type generator.

Signed-off-by: Dominik Roth <dominik@composable.finance>

Co-authored-by: Dominik Roth <96540347+Dom-Roth@users.noreply.github.com>
Co-authored-by: Dominik Roth <dominik@composable.finance>
  • Loading branch information
3 people authored Jan 18, 2022
1 parent 718e790 commit 58a45cd
Show file tree
Hide file tree
Showing 36 changed files with 22,670 additions and 945 deletions.
3 changes: 2 additions & 1 deletion frame/bonded-finance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ pub mod pallet {
/// The minimum reward for an offer.
///
/// Must be > T::Vesting::MinVestedTransfer.
#[pallet::constant]
type MinReward: Get<BalanceOf<Self>>;

/// The origin that is allowed to cancel bond offers.
Expand Down Expand Up @@ -250,7 +251,7 @@ pub mod pallet {
&offer_account,
&issuer,
offer.reward.amount,
true,
false,
)?;
BondOffers::<T>::remove(offer_id);
Self::deposit_event(Event::<T>::OfferCancelled { offer_id });
Expand Down
12 changes: 12 additions & 0 deletions integration-tests/runtime-tests/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"diff": true,
"extension": ["js", "cjs", "mjs"],
"package": "./package.json",
"reporter": "mochawesome",
"slow": "75",
"timeout": "2000",
"ui": "bdd",
"watch-files": ["lib/**/*.js", "test/**/*.js"],
"watch-ignore": ["lib/vendor"],
"require": "src/utils/testSetup.js"
}
8 changes: 7 additions & 1 deletion integration-tests/runtime-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ $ npm run init
$ npm run test
```

### To run the type generator:
```bash
$ npm run gen
```


## ToDo:
* Add all general test cases.
Expand All @@ -43,7 +48,8 @@ Else the test will timeout before any results, causing a headache and wondering
e.g.
```typescript
describe('Imaginary Test', function () {
this.timeout(0); // <--
// Timeout set to 2 minutes
this.timeout(2*60*1000); // <--
it('Imaginary test part', async (done) => {
// Test Stuff...
});
Expand Down
Loading

0 comments on commit 58a45cd

Please sign in to comment.