Skip to content

Commit

Permalink
fix: bug in pauseSto, calledWith args, prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Wiebe committed Nov 20, 2019
1 parent 4a311be commit 5ee5b02
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/procedures/__tests__/PauseSto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('PauseSto', () => {
let usdTieredStoFactoryMock: MockManager<usdTieredStoFactoryModule.UsdTieredStoFactory>;

let securityTokenMock: MockManager<contractWrappersModule.SecurityToken_3_0_0>;
let moduleFactoryMock: MockManager<contractWrappersModule.ModuleFactory_3_0_0>;

let factoryMockSetup: Factories;
let securityTokenId: string;

Expand All @@ -73,15 +73,11 @@ describe('PauseSto', () => {

securityTokenMock = ImportMock.mockClass(contractWrappersModule, 'SecurityToken_3_0_0');

moduleFactoryMock = ImportMock.mockClass(contractWrappersModule, 'ModuleFactory_3_0_0');

tokenFactoryMock.mock(
'getSecurityTokenInstanceFromTicker',
securityTokenMock.getMockInstance()
);

moduleWrapperFactoryMock.mock('getModuleInstance', moduleFactoryMock.getMockInstance());

cappedStoFactoryMock = ImportMock.mockClass(cappedStoFactoryModule, 'CappedStoFactory');

usdTieredStoFactoryMock = ImportMock.mockClass(
Expand All @@ -99,6 +95,8 @@ describe('PauseSto', () => {

securityTokenId = SecurityToken.generateId({ symbol: cappedParams.symbol });

moduleWrapperFactoryMock.mock('getModuleInstance', cappedStoMock.getMockInstance());

// Instantiate PauseSto
target = new PauseSto(cappedParams, contextMock.getMockInstance());
});
Expand All @@ -116,10 +114,12 @@ describe('PauseSto', () => {
describe('PauseSto', () => {
test('should add the transaction to the queue to pause a capped sto', async () => {
const addTransactionSpy = spy(target, 'addTransaction');
cappedStoMock.mock('pause', Promise.resolve('Pause'));

// Real call
await target.prepareTransactions();

// Verifications
// Verifications\
expect(
addTransactionSpy.getCall(0).calledWith(cappedStoMock.getMockInstance().pause)
).toEqual(true);
Expand All @@ -128,9 +128,12 @@ describe('PauseSto', () => {
});

test('should add the transaction to the queue to pause a usdTiered sto', async () => {
moduleWrapperFactoryMock.mock('getModuleInstance', usdTieredStoMock.getMockInstance());
target = new PauseSto(usdTieredParams, contextMock.getMockInstance());

const addTransactionSpy = spy(target, 'addTransaction');
usdTieredStoMock.mock('pause', Promise.resolve('Pause'));

// Real call
await target.prepareTransactions();

Expand Down

0 comments on commit 5ee5b02

Please sign in to comment.