Skip to content

Commit 72b7a93

Browse files
author
Victor Wiebe
committed
test: isCostInPoly in the stos
1 parent 10a1a98 commit 72b7a93

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

src/procedures/__tests__/LaunchCappedSto.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,26 @@ describe('LaunchCappedSto', () => {
129129
expect(addProcedureSpy.callCount).toEqual(1);
130130
});
131131

132+
test('should add a transaction to the queue to launch a capped sto with cost in poly', async () => {
133+
const addProcedureSpy = spy(target, 'addProcedure');
134+
const addTransactionSpy = spy(target, 'addTransaction');
135+
136+
moduleFactoryMock.mock('isCostInPoly', Promise.resolve(true));
137+
138+
// Real call
139+
await target.prepareTransactions();
140+
141+
// Verifications
142+
expect(
143+
addTransactionSpy
144+
.getCall(0)
145+
.calledWith(securityTokenMock.getMockInstance().addModuleWithLabel)
146+
).toEqual(true);
147+
expect(addTransactionSpy.callCount).toEqual(1);
148+
expect(addProcedureSpy.getCall(0).calledWith(TransferErc20)).toEqual(true);
149+
expect(addProcedureSpy.callCount).toEqual(1);
150+
});
151+
132152
test('should throw if corresponding capped sto event is not fired', async () => {
133153
ImportMock.mockFunction(utilsModule, 'findEvents', []);
134154

src/procedures/__tests__/LaunchUsdTieredSto.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ const params: LaunchUsdTieredStoProcedureArgs = {
3232
{
3333
tokensOnSale: new BigNumber(1),
3434
price: new BigNumber(1),
35-
discountedPrice: new BigNumber(1),
36-
tokensWithDiscount: new BigNumber(1),
3735
},
3836
],
3937
nonAccreditedInvestmentLimit: new BigNumber(1),
@@ -151,6 +149,25 @@ describe('LaunchUsdTieredSto', () => {
151149
expect(addProcedureSpy.callCount).toEqual(1);
152150
});
153151

152+
test('should add the transaction to the queue to launch usd tiered sto with cost in poly', async () => {
153+
const addProcedureSpy = spy(target, 'addProcedure');
154+
const addTransactionSpy = spy(target, 'addTransaction');
155+
156+
moduleFactoryMock.mock('isCostInPoly', Promise.resolve(true));
157+
// Real call
158+
await target.prepareTransactions();
159+
160+
// Verifications
161+
expect(
162+
addTransactionSpy
163+
.getCall(0)
164+
.calledWith(securityTokenMock.getMockInstance().addModuleWithLabel)
165+
).toEqual(true);
166+
expect(addTransactionSpy.callCount).toEqual(1);
167+
expect(addProcedureSpy.getCall(0).calledWith(TransferErc20)).toEqual(true);
168+
expect(addProcedureSpy.callCount).toEqual(1);
169+
});
170+
154171
test('should throw if corresponding usd tiered sto event is not fired', async () => {
155172
findEventsStub = ImportMock.mockFunction(utilsModule, 'findEvents', []);
156173

0 commit comments

Comments
 (0)