diff --git a/packages/inter-protocol/test/vaultFactory/snapshots/vaultFactory.test.js.md b/packages/inter-protocol/test/vaultFactory/snapshots/vaultFactory.test.js.md index f8f766c8bfa3..d814867d4117 100644 --- a/packages/inter-protocol/test/vaultFactory/snapshots/vaultFactory.test.js.md +++ b/packages/inter-protocol/test/vaultFactory/snapshots/vaultFactory.test.js.md @@ -72,11 +72,11 @@ Generated by [AVA](https://avajs.dev). compoundedInterest: { denominator: { brand: Object @Alleged: IST brand {}, - value: 100000000000000000000n, + value: 857701650301172500n, }, numerator: { brand: Object @Alleged: IST brand {}, - value: 101967213114754098360n, + value: 874574469651359500n, }, }, interestRate: { @@ -387,11 +387,11 @@ Generated by [AVA](https://avajs.dev). interest: { denominator: { brand: Object @Alleged: IST brand {}, - value: 100000000000000000000n, + value: 857701650301172500n, }, numerator: { brand: Object @Alleged: IST brand {}, - value: 101967213114754098360n, + value: 874574469651359500n, }, }, }, @@ -413,11 +413,11 @@ Generated by [AVA](https://avajs.dev). interest: { denominator: { brand: Object @Alleged: IST brand {}, - value: 100000000000000000000n, + value: 857701650301172500n, }, numerator: { brand: Object @Alleged: IST brand {}, - value: 101967213114754098360n, + value: 874574469651359500n, }, }, }, diff --git a/packages/inter-protocol/test/vaultFactory/snapshots/vaultFactory.test.js.snap b/packages/inter-protocol/test/vaultFactory/snapshots/vaultFactory.test.js.snap index cd6de400d63f..a5a848519057 100644 Binary files a/packages/inter-protocol/test/vaultFactory/snapshots/vaultFactory.test.js.snap and b/packages/inter-protocol/test/vaultFactory/snapshots/vaultFactory.test.js.snap differ diff --git a/packages/inter-protocol/test/vaultFactory/vaultFactory.test.js b/packages/inter-protocol/test/vaultFactory/vaultFactory.test.js index 66e179ca645d..f285b00bd00e 100644 --- a/packages/inter-protocol/test/vaultFactory/vaultFactory.test.js +++ b/packages/inter-protocol/test/vaultFactory/vaultFactory.test.js @@ -1838,6 +1838,13 @@ test('manager notifiers, with snapshot', async t => { }), ); ({ vault } = await E(vaultSeat).getOfferResult()); + totalCollateral += ENOUGH; + totalDebt += DEBT2; + await m.assertChange({ + numActiveVaults: 4, + totalCollateral: { value: totalCollateral }, + totalDebt: { value: totalDebt }, + }); trace('6. Loan interest'); vaultSeat = await E(services.zoe).offer( @@ -1851,18 +1858,21 @@ test('manager notifiers, with snapshot', async t => { }), ); ({ vault } = await E(vaultSeat).getOfferResult()); - totalCollateral += ENOUGH; - totalDebt += DEBT2; + totalCollateral += AMPLE; + totalDebt += DEBT1; await m.assertChange({ - numActiveVaults: 4, + numActiveVaults: 5, totalCollateral: { value: totalCollateral }, totalDebt: { value: totalDebt }, }); - m.addDebt(DEBT2); + await manualTimer.tickN(5); + // This is interest for a single vault. const interestAccrued = (await E(vault).getCurrentDebt()).value - DEBT1; m.addDebt(interestAccrued); - t.is(interestAccrued, 9n); + + t.is(interestAccrued, 9n); // interest on OPEN1 for 5 periods + totalDebt += 30n; // interest on 270_000 for 5 periods trace('7. make another loan to trigger a publish'); vaultSeat = await E(services.zoe).offer( @@ -1876,10 +1886,10 @@ test('manager notifiers, with snapshot', async t => { }), ); ({ vault } = await E(vaultSeat).getOfferResult()); - totalCollateral += AMPLE; - totalDebt += DEBT1; + totalCollateral += ENOUGH; + totalDebt += DEBT2; await m.assertChange({ - numActiveVaults: 5, + numActiveVaults: 6, totalCollateral: { value: totalCollateral }, totalDebt: { value: totalDebt }, }); @@ -1898,11 +1908,10 @@ test('manager notifiers, with snapshot', async t => { }), ); ({ vault } = await E(vaultSeat).getOfferResult()); - totalCollateral += ENOUGH; - totalDebt += DEBT2 + 30n; // XXX ?? - m.addDebt(DEBT2); + totalCollateral += AMPLE; + totalDebt += DEBT1; await m.assertChange({ - numActiveVaults: 6, + numActiveVaults: 7, totalCollateral: { value: totalCollateral }, totalDebt: { value: totalDebt }, }); @@ -1925,20 +1934,11 @@ test('manager notifiers, with snapshot', async t => { }), ); await E(vaultOpSeat).getOfferResult(); - totalCollateral += AMPLE; - totalDebt += DEBT1; - await m.assertChange({ - numActiveVaults: 7, - totalDebt: { value: totalDebt }, - totalCollateral: { value: totalCollateral }, - }); - totalCollateral += given.value; - totalDebt += WANT_EXTRA + 20n; // magic number is fees - + totalDebt += WANT_EXTRA + 20n; await m.assertChange({ - totalCollateral: { value: totalCollateral }, totalDebt: { value: totalDebt }, + totalCollateral: { value: totalCollateral }, }); trace('10. Close vault');