Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
Update mkr redeemer migration check to return balance
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanbennett committed Dec 10, 2019
1 parent 231f6c3 commit 11f4d67
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
10 changes: 5 additions & 5 deletions packages/dai-plugin-migrations/src/migrations/MkrRedeemer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ export default class MkrRedeemer {
return this;
}

async check() {
const balance = await this.oldMkrBalance();
return balance.gt(0);
}
// async check() {
// const balance = await this.oldMkrBalance();
// return balance.gt(0);
// }

oldMkrBalance() {
async check() {
const oldMkr = this._manager.get('token').getToken('OLD_MKR');
return oldMkr.balance();
}
Expand Down
17 changes: 6 additions & 11 deletions packages/dai-plugin-migrations/test/migrations/MkrRedeemer.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { migrationMaker } from '../helpers';
import { ServiceRoles, Migrations } from '../../src/constants';
import { OLD_MKR } from '../../src';

let maker, migration;

Expand All @@ -11,22 +12,16 @@ describe('MKR migration check', () => {
.getMigration(Migrations.MKR_REDEEMER);
});

test('if the account has no old MKR, return false', async () => {
test('if the account has no old MKR, return zero', async () => {
await addFreshAccount();
maker.service('accounts').useAccount('newAccount');
const amount = await migration.oldMkrBalance();

expect(amount.toNumber()).toBe(0);
expect(await migration.check()).toBeFalsy();

expect(await migration.check()).toEqual(OLD_MKR(0));
maker.service('accounts').useAccount('default');
});

test('if the account has old MKR, return true', async () => {
const amount = await migration.oldMkrBalance();

expect(amount.toNumber()).toBe(400);
expect(await migration.check()).toBeTruthy();
test('if the account has old MKR, return balance', async () => {
const amount = await migration.check();
expect(amount).toEqual(OLD_MKR(400));
});
});

Expand Down

0 comments on commit 11f4d67

Please sign in to comment.