Skip to content

Commit

Permalink
fix: add await in all expect functions
Browse files Browse the repository at this point in the history
  • Loading branch information
shuffledex committed Nov 8, 2019
1 parent a9c8ee8 commit 997f53f
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/procedures/__tests__/SetController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,12 @@ describe('SetController', () => {
// Instantiate SetController with incorrect security symbol
target = new SetController(params, 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 @@ -91,7 +89,7 @@ describe('SetController', () => {
);

// Real call rejects
expect(target.prepareTransactions()).rejects.toThrowError(
await expect(target.prepareTransactions()).rejects.toThrowError(
new PolymathError({
code: ErrorCode.ProcedureValidationError,
message: `Controller address "Inappropriate" is invalid.`,
Expand All @@ -110,7 +108,7 @@ describe('SetController', () => {
target = new SetController(params, contextMock.getMockInstance());

// Real call rejects
expect(target.prepareTransactions()).rejects.toThrowError(
await expect(target.prepareTransactions()).rejects.toThrowError(
new PolymathError({
code: ErrorCode.ProcedureValidationError,
message: `You must be the owner of this Security Token to set the controller`,
Expand All @@ -133,7 +131,7 @@ describe('SetController', () => {
await target.prepareTransactions();

// Verifications
expect(
await expect(
addTransactionSpy
.getCall(0)
.calledWithExactly(
Expand Down

0 comments on commit 997f53f

Please sign in to comment.