difftreelog
Merge pull request #248 from UniqueNetwork/fix/develop_tests
in: master
Fix/develop tests
3 files changed
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -177,18 +177,18 @@
.checked_add(1)
.ok_or(ArithmeticError::Overflow)?;
- let balance = <AccountBalance<T>>::get((collection.id, sender))
+ let balance = <AccountBalance<T>>::get((collection.id, token_data.owner.clone()))
.checked_sub(1)
.ok_or(ArithmeticError::Overflow)?;
if balance == 0 {
- <AccountBalance<T>>::remove((collection.id, sender));
+ <AccountBalance<T>>::remove((collection.id, token_data.owner.clone()));
} else {
- <AccountBalance<T>>::insert((collection.id, sender), balance);
+ <AccountBalance<T>>::insert((collection.id, token_data.owner.clone()), balance);
}
// =========
- <Owned<T>>::remove((collection.id, &token_data.owner, token));
+ <Owned<T>>::remove((collection.id, &token_data.owner.clone(), token));
<TokensBurnt<T>>::insert(collection.id, burnt);
<TokenData<T>>::remove((collection.id, token));
let old_spender = <Allowance<T>>::take((collection.id, token));
tests/src/approve.test.tsdiffbeforeafterboth--- a/tests/src/approve.test.ts
+++ b/tests/src/approve.test.ts
@@ -24,7 +24,6 @@
} from './util/helpers';
chai.use(chaiAsPromised);
-const expect = chai.expect;
describe('Integration Test approve(spender, collection_id, item_id, amount):', () => {
let alice: IKeyringPair;
tests/src/inflation.test.tsdiffbeforeafterboth18 const totalIssuanceStart = (await api.query.inflation.startingYearTotalIssuance()).toBigInt();18 const totalIssuanceStart = (await api.query.inflation.startingYearTotalIssuance()).toBigInt();19 const blockInflation = (await api.query.inflation.blockInflation()).toBigInt();19 const blockInflation = (await api.query.inflation.blockInflation()).toBigInt();202021 // const YEAR = 5259600n; // 6-second block. Blocks in one year21 const YEAR = 5259600n; // Blocks in one year22 const YEAR = 2629800n; // 12-second block. Blocks in one year2322 const totalExpectedInflation = totalIssuanceStart / 10n;24 const totalExpectedInflation = totalIssuanceStart / 10n;23 const totalActualInflation = blockInflation * YEAR / blockInterval;25 const totalActualInflation = blockInflation * YEAR / blockInterval;242625 const tolerance = 0.00001; // Relative difference per year between theoretical and actual inflation27 const tolerance = 0.00001; // Relative difference per year between theoretical and actual inflation26 let abs = totalExpectedInflation / totalActualInflation - 1n;28 const expectedInflation = totalExpectedInflation / totalActualInflation - 1n;27 if (abs < 0n) {2928 abs = -abs;29 }30 expect(abs <= tolerance).to.be.true;30 expect(Math.abs(Number(expectedInflation))).to.be.lessThanOrEqual(tolerance);31 });31 });32 });32 });3333