Skip to content

Commit f30a0fb

Browse files
fix: sdk and contracts tests
Signed-off-by: Axel Loupias <[email protected]>
1 parent f8b2265 commit f30a0fb

File tree

13 files changed

+41
-34
lines changed

13 files changed

+41
-34
lines changed

apps/ats/web/eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ const webConfig = baseConfig
5252
},
5353
]);
5454

55-
export default webConfig;
55+
export default webConfig;

apps/ats/web/prettier.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
*/
55
import baseConfig from '../../../prettier.config.mjs';
66

7-
export default baseConfig;
7+
export default baseConfig;

packages/ats/contracts/test/unitTests/layer_1/beneficiaries/beneficiaries.test.ts

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const BENEFICIARY_2 = '0x2345678901234567890123456789012345678901'
3030
const BENEFICIARY_2_DATA = '0x88888888'
3131
const numberOfUnits = 1000
3232
let startingDate = 999999999999990
33+
const couponRateDecimals = 2
3334
const couponFrequency = 0
3435
const couponRate = 0
3536
let maturityDate = 999999999999999
@@ -90,6 +91,7 @@ describe('Beneficiaries Tests', () => {
9091
maturityDate,
9192
couponFrequency,
9293
couponRate,
94+
couponRateDecimals,
9395
firstCouponDate,
9496
regulationType: RegulationType.REG_D,
9597
regulationSubType: RegulationSubType.REG_D_506_C,
@@ -136,14 +138,12 @@ describe('Beneficiaries Tests', () => {
136138

137139
describe('Add Tests', () => {
138140
it('GIVEN an unlisted beneficiary WHEN unauthorized user adds it THEN it reverts with AccountHasNoRole', async () => {
139-
beneficiariesFacet = beneficiariesFacet.connect(signer_B)
140-
141141
await expect(
142-
beneficiariesFacet.addBeneficiary(
143-
BENEFICIARY_1,
144-
BENEFICIARY_1_DATA,
145-
{ gasLimit: GAS_LIMIT.default }
146-
)
142+
beneficiariesFacet
143+
.connect(signer_B)
144+
.addBeneficiary(BENEFICIARY_1, BENEFICIARY_1_DATA, {
145+
gasLimit: GAS_LIMIT.default,
146+
})
147147
).to.be.revertedWithCustomError(
148148
beneficiariesFacet,
149149
'AccountHasNoRole'
@@ -203,12 +203,12 @@ describe('Beneficiaries Tests', () => {
203203

204204
describe('Remove Tests', () => {
205205
it('GIVEN a listed beneficiary WHEN unauthorized user removes it THEN it reverts with AccountHasNoRole', async () => {
206-
beneficiariesFacet = beneficiariesFacet.connect(signer_B)
207-
208206
await expect(
209-
beneficiariesFacet.removeBeneficiary(BENEFICIARY_2, {
210-
gasLimit: GAS_LIMIT.default,
211-
})
207+
beneficiariesFacet
208+
.connect(signer_B)
209+
.removeBeneficiary(BENEFICIARY_2, {
210+
gasLimit: GAS_LIMIT.default,
211+
})
212212
).to.be.revertedWithCustomError(
213213
beneficiariesFacet,
214214
'AccountHasNoRole'
@@ -217,7 +217,6 @@ describe('Beneficiaries Tests', () => {
217217

218218
it('GIVEN an listed beneficiary WHEN user removes it if token is paused THEN it reverts with TokenIsPaused', async () => {
219219
await pauseFacet.pause({ gasLimit: GAS_LIMIT.default })
220-
221220
await expect(
222221
beneficiariesFacet.removeBeneficiary(BENEFICIARY_2, {
223222
gasLimit: GAS_LIMIT.default,
@@ -258,14 +257,12 @@ describe('Beneficiaries Tests', () => {
258257

259258
describe('Update Data Tests', () => {
260259
it('GIVEN a listed beneficiary WHEN unauthorized user updates its data THEN it reverts with AccountHasNoRole', async () => {
261-
beneficiariesFacet = beneficiariesFacet.connect(signer_B)
262-
263260
await expect(
264-
beneficiariesFacet.updateBeneficiaryData(
265-
BENEFICIARY_2,
266-
BENEFICIARY_1_DATA,
267-
{ gasLimit: GAS_LIMIT.default }
268-
)
261+
beneficiariesFacet
262+
.connect(signer_B)
263+
.updateBeneficiaryData(BENEFICIARY_2, BENEFICIARY_1_DATA, {
264+
gasLimit: GAS_LIMIT.default,
265+
})
269266
).to.be.revertedWithCustomError(
270267
beneficiariesFacet,
271268
'AccountHasNoRole'
@@ -274,7 +271,6 @@ describe('Beneficiaries Tests', () => {
274271

275272
it('GIVEN an listed beneficiary WHEN user updates its data if token is paused THEN it reverts with TokenIsPaused', async () => {
276273
await pauseFacet.pause({ gasLimit: GAS_LIMIT.default })
277-
278274
await expect(
279275
beneficiariesFacet.updateBeneficiaryData(
280276
BENEFICIARY_2,

packages/ats/sdk/__tests__/fixtures/bond/BondFixture.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ export const CreateBondCommandFixture = createFixture<CreateBondCommand>(
306306
]);
307307
command.complianceId?.as(() => HederaIdPropsFixture.create().value);
308308
command.identityRegistryId?.as(() => HederaIdPropsFixture.create().value);
309+
command.beneficiariesIds?.faker((faker) => [
310+
HederaIdPropsFixture.create().value,
311+
]);
312+
command.beneficiariesData?.as(() => ['0x0000']);
309313
},
310314
);
311315

packages/ats/sdk/__tests__/fixtures/shared/SecurityFixture.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ export const SecurityPropsFixture = createFixture<SecurityProps>((security) => {
229229
);
230230
security.decimals.faker((faker) => faker.number.int({ min: 0, max: 18 }));
231231
security.isWhiteList.faker((faker) => faker.datatype.boolean());
232+
security.erc20VotesActivated?.faker((faker) => faker.datatype.boolean());
232233
security.isControllable.faker((faker) => faker.datatype.boolean());
233234
security.arePartitionsProtected.faker((faker) => faker.datatype.boolean());
234235
security.clearingActive.faker((faker) => faker.datatype.boolean());

packages/ats/sdk/eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ const sdkConfig = baseConfig
6262
},
6363
]);
6464

65-
export default sdkConfig;
65+
export default sdkConfig;

packages/ats/sdk/prettier.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
*/
55
import baseConfig from '../../../prettier.config.mjs';
66

7-
export default baseConfig;
7+
export default baseConfig;

packages/ats/sdk/src/app/usecase/command/bond/create/CreateBondCommandHandler.unit.test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,10 @@ describe('CreateBondCommandHandler', () => {
356356
contractServiceMock.getEvmAddressesFromHederaIds
357357
.mockResolvedValueOnce([externalPauseEvmAddress])
358358
.mockResolvedValueOnce([externalControlEvmAddress])
359-
.mockResolvedValueOnce([externalKycEvmAddress])
360-
.mockResolvedValueOnce([evmAddress]);
361-
accountServiceMock.getAccountEvmAddress.mockResolvedValue(evmAddress);
359+
.mockResolvedValueOnce([externalKycEvmAddress]);
360+
accountServiceMock.getAccountEvmAddress
361+
.mockResolvedValue(evmAddress)
362+
.mockResolvedValue(evmAddress);
362363

363364
transactionServiceMock.getHandler().createBond.mockResolvedValue({
364365
id: transactionId,
@@ -383,9 +384,9 @@ describe('CreateBondCommandHandler', () => {
383384
);
384385
expect(
385386
contractServiceMock.getEvmAddressesFromHederaIds,
386-
).toHaveBeenCalledTimes(4);
387+
).toHaveBeenCalledTimes(3);
387388
expect(accountServiceMock.getAccountEvmAddress).toHaveBeenCalledTimes(
388-
1,
389+
2,
389390
);
390391
expect(
391392
transactionServiceMock.getHandler().createBond,

packages/ats/sdk/src/app/usecase/command/bond/createTrexSuite/CreateTrexSuiteBondCommandHandler.unit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,9 @@ describe('CreateTrexSuiteBondCommandHandler', () => {
329329
);
330330
expect(
331331
contractServiceMock.getEvmAddressesFromHederaIds,
332-
).toHaveBeenCalledTimes(4);
332+
).toHaveBeenCalledTimes(3);
333333
expect(accountServiceMock.getAccountEvmAddress).toHaveBeenCalledTimes(
334-
1,
334+
2,
335335
);
336336
expect(
337337
transactionServiceMock.getHandler().createTrexSuiteBond,

packages/ats/sdk/src/app/usecase/command/security/beneficiaries/updateBeneficiaryData/UpdateBeneficiaryDataCommandHandler.unit.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ describe('UpdateBeneficiaryDataCommandHandler', () => {
303303
).toHaveBeenCalledWith(
304304
evmAddress,
305305
beneficiaryEvmAddress,
306+
command.data,
306307
command.securityId,
307308
);
308309
});

0 commit comments

Comments
 (0)