Skip to content

Commit

Permalink
fix: add feedback fixes requested by Jere
Browse files Browse the repository at this point in the history
  • Loading branch information
shuffledex committed Nov 8, 2019
1 parent dc555ff commit f794f99
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/procedures/SetDividendsWallet.ts
Expand Up @@ -19,7 +19,7 @@ import {
EthDividendsManager,
} from '../entities';

export const createSetDividendWalletResolver = (
export const createSetDividendsWalletResolver = (
dividendType: DividendType,
factories: Factories,
symbol: string
Expand Down Expand Up @@ -102,7 +102,7 @@ export class SetDividendsWallet extends Procedure<

await this.addTransaction(dividendModule.changeWallet, {
tag: PolyTransactionTag.SetDividendsWallet,
resolver: createSetDividendWalletResolver(
resolver: createSetDividendsWalletResolver(
dividendType,
factories,
symbol
Expand Down
26 changes: 14 additions & 12 deletions src/procedures/__tests__/SetDividendsWallet.ts
Expand Up @@ -104,14 +104,12 @@ describe('SetDividendsWallet', () => {
contextMock.getMockInstance()
);

tokenFactoryMock.set(
'getSecurityTokenInstanceFromTicker',
stub()
.withArgs({ address: params.symbol })
.throws()
);
tokenFactoryMock
.mock('getSecurityTokenInstanceFromTicker')
.withArgs(params.symbol)
.throws();

expect(target.prepareTransactions()).rejects.toThrow(
await expect(target.prepareTransactions()).rejects.toThrow(
new PolymathError({
code: ErrorCode.ProcedureValidationError,
message: `There is no Security Token with symbol ${params.symbol}`,
Expand All @@ -126,7 +124,7 @@ describe('SetDividendsWallet', () => {
contextMock.getMockInstance()
);

expect(target.prepareTransactions()).rejects.toThrow(
await expect(target.prepareTransactions()).rejects.toThrow(
new PolymathError({
code: ErrorCode.ProcedureValidationError,
message: "Dividends of the specified type haven't been enabled",
Expand All @@ -143,7 +141,7 @@ describe('SetDividendsWallet', () => {
wrappersMock.mock('getAttachedModules', Promise.resolve([]));

// Real call
expect(target.prepareTransactions()).rejects.toThrowError(
await expect(target.prepareTransactions()).rejects.toThrowError(
new PolymathError({
code: ErrorCode.ProcedureValidationError,
message: "Dividends of the specified type haven't been enabled",
Expand All @@ -160,7 +158,7 @@ describe('SetDividendsWallet', () => {
wrappersMock.mock('getAttachedModules', Promise.resolve([]));

// Real call
expect(target.prepareTransactions()).rejects.toThrowError(
await expect(target.prepareTransactions()).rejects.toThrowError(
new PolymathError({
code: ErrorCode.ProcedureValidationError,
message: "Dividends of the specified type haven't been enabled",
Expand Down Expand Up @@ -233,11 +231,13 @@ describe('SetDividendsWallet', () => {
'refresh',
Promise.resolve(undefined)
);
const resolverValue = setDividendsWalletModule.createSetDividendWalletResolver(

const resolverValue = await setDividendsWalletModule.createSetDividendsWalletResolver(
DividendType.Erc20,
factoriesMockedSetup,
params.symbol
)();

expect(
refreshStub.getCall(0).calledWithExactly(
Erc20DividendsManager.generateId({
Expand All @@ -258,11 +258,13 @@ describe('SetDividendsWallet', () => {
'refresh',
Promise.resolve(undefined)
);
const resolverValue = setDividendsWalletModule.createSetDividendWalletResolver(

const resolverValue = await setDividendsWalletModule.createSetDividendsWalletResolver(
DividendType.Eth,
factoriesMockedSetup,
params.symbol
)();

expect(
refreshStub.getCall(0).calledWithExactly(
EthDividendsManager.generateId({
Expand Down

0 comments on commit f794f99

Please sign in to comment.