Skip to content

Commit 3960d44

Browse files
authored
feat: coverage control in pipeline (#1303)
Signed-off-by: mamoralesiob <miguelangel@io.builders>
1 parent ff4398b commit 3960d44

1 file changed

Lines changed: 31 additions & 31 deletions

File tree

packages/ats/contracts/test/contracts/integration/accessControl/accessControl.test.ts

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,52 +26,52 @@ export function accessControlTests(getCtx: () => AssetMockCtx): void {
2626
await executeRbac(asset, [{ role: ATS_ROLES.ROLE_PAUSER, members: [ctx.user1.address] }]);
2727
});
2828

29-
it("GIVEN a deactivated asset WHEN grantRole THEN transaction fails with Deactivated", async () => {
29+
it.only("GIVEN a deactivated asset WHEN grantRole THEN transaction fails with Deactivated", async () => {
3030
await asset.forceDeactivate();
3131
await expect(
3232
asset.connect(deployer).grantRole(ATS_ROLES.ROLE_PAUSER, unknownSigner.address),
3333
).to.be.revertedWithCustomError(asset, "Deactivated");
3434
});
3535

36-
it("GIVEN an account without administrative role WHEN grantRole THEN transaction fails with AccountHasNoRole", async () => {
36+
it.only("GIVEN an account without administrative role WHEN grantRole THEN transaction fails with AccountHasNoRole", async () => {
3737
await expect(asset.connect(signer_C).grantRole(ATS_ROLES.ROLE_PAUSER, unknownSigner.address))
3838
.to.be.revertedWithCustomError(asset, "AccountHasNoRole")
3939
.withArgs(signer_C.address, ATS_ROLES.DEFAULT_ADMIN_ROLE);
4040
});
4141

42-
it("GIVEN a deactivated asset WHEN revokeRole THEN transaction fails with Deactivated", async () => {
42+
it.only("GIVEN a deactivated asset WHEN revokeRole THEN transaction fails with Deactivated", async () => {
4343
await asset.forceDeactivate();
4444
await expect(
4545
asset.connect(deployer).revokeRole(ATS_ROLES.DEFAULT_ADMIN_ROLE, unknownSigner.address),
4646
).to.be.revertedWithCustomError(asset, "Deactivated");
4747
});
4848

49-
it("GIVEN an account without administrative role WHEN revokeRole THEN transaction fails with AccountHasNoRole", async () => {
49+
it.only("GIVEN an account without administrative role WHEN revokeRole THEN transaction fails with AccountHasNoRole", async () => {
5050
await expect(asset.connect(signer_C).revokeRole(ATS_ROLES.DEFAULT_ADMIN_ROLE, unknownSigner.address))
5151
.to.be.revertedWithCustomError(asset, "AccountHasNoRole")
5252
.withArgs(signer_C.address, ATS_ROLES.DEFAULT_ADMIN_ROLE);
5353
});
5454

55-
it("GIVEN a deactivated asset WHEN applyRoles THEN transaction fails with Deactivated", async () => {
55+
it.only("GIVEN a deactivated asset WHEN applyRoles THEN transaction fails with Deactivated", async () => {
5656
await asset.forceDeactivate();
5757
await expect(
5858
asset.connect(signer_C).applyRoles([ATS_ROLES.DEFAULT_ADMIN_ROLE], [true], unknownSigner.address),
5959
).to.be.revertedWithCustomError(asset, "Deactivated");
6060
});
6161

62-
it("GIVEN an account without administrative role WHEN applyRoles THEN transaction fails with AccountHasNoRole", async () => {
62+
it.only("GIVEN an account without administrative role WHEN applyRoles THEN transaction fails with AccountHasNoRole", async () => {
6363
await expect(asset.connect(signer_C).applyRoles([ATS_ROLES.DEFAULT_ADMIN_ROLE], [true], unknownSigner.address))
6464
.to.be.revertedWithCustomError(asset, "AccountHasNoRole")
6565
.withArgs(signer_C.address, ATS_ROLES.DEFAULT_ADMIN_ROLE);
6666
});
6767

68-
it("GIVEN a list of roles and actives that is not equally long WHEN applyRoles THEN transaction fails with RolesAndActivesLengthMismatch", async () => {
68+
it.only("GIVEN a list of roles and actives that is not equally long WHEN applyRoles THEN transaction fails with RolesAndActivesLengthMismatch", async () => {
6969
await expect(asset.connect(signer_C).applyRoles([ATS_ROLES.DEFAULT_ADMIN_ROLE], [], unknownSigner.address))
7070
.to.be.revertedWithCustomError(asset, "RolesAndActivesLengthMismatch")
7171
.withArgs(1, 0);
7272
});
7373

74-
it("GIVEN a list of contradictory roles (enable and disable) role WHEN applyRoles THEN transaction fails with ApplyRoleContradiction", async () => {
74+
it.only("GIVEN a list of contradictory roles (enable and disable) role WHEN applyRoles THEN transaction fails with ApplyRoleContradiction", async () => {
7575
const Roles_1 = [
7676
ATS_ROLES.DEFAULT_ADMIN_ROLE,
7777
ATS_ROLES.ROLE_PAUSER,
@@ -96,31 +96,31 @@ export function accessControlTests(getCtx: () => AssetMockCtx): void {
9696
.withArgs(3, 6);
9797
});
9898

99-
it("GIVEN a paused Token WHEN grantRole THEN transaction fails with IsPaused", async () => {
99+
it.only("GIVEN a paused Token WHEN grantRole THEN transaction fails with IsPaused", async () => {
100100
await asset.connect(signer_B).pause();
101101

102102
await expect(
103103
asset.connect(deployer).grantRole(ATS_ROLES.ROLE_PAUSER, unknownSigner.address),
104104
).to.be.revertedWithCustomError(asset, "IsPaused");
105105
});
106106

107-
it("GIVEN a paused Token WHEN revokeRole THEN transaction fails with IsPaused", async () => {
107+
it.only("GIVEN a paused Token WHEN revokeRole THEN transaction fails with IsPaused", async () => {
108108
await asset.connect(signer_B).pause();
109109

110110
await expect(
111111
asset.connect(deployer).revokeRole(ATS_ROLES.ROLE_PAUSER, unknownSigner.address),
112112
).to.be.revertedWithCustomError(asset, "IsPaused");
113113
});
114114

115-
it("GIVEN a deactivated asset WHEN renounceRole THEN transaction fails with Deactivated", async () => {
115+
it.only("GIVEN a deactivated asset WHEN renounceRole THEN transaction fails with Deactivated", async () => {
116116
await asset.forceDeactivate();
117117
await expect(asset.connect(signer_C).renounceRole(ATS_ROLES.ROLE_PAUSER)).to.be.revertedWithCustomError(
118118
asset,
119119
"Deactivated",
120120
);
121121
});
122122

123-
it("GIVEN a paused Token WHEN renounce THEN transaction fails with IsPaused", async () => {
123+
it.only("GIVEN a paused Token WHEN renounce THEN transaction fails with IsPaused", async () => {
124124
// Pausing the token
125125
await asset.connect(signer_B).pause();
126126

@@ -131,7 +131,7 @@ export function accessControlTests(getCtx: () => AssetMockCtx): void {
131131
);
132132
});
133133

134-
it("GIVEN an paused Token WHEN applyRoles THEN transaction fails with IsPaused", async () => {
134+
it.only("GIVEN an paused Token WHEN applyRoles THEN transaction fails with IsPaused", async () => {
135135
// Pausing the token
136136
await asset.connect(signer_B).pause();
137137

@@ -141,7 +141,7 @@ export function accessControlTests(getCtx: () => AssetMockCtx): void {
141141
).to.be.revertedWithCustomError(asset, "IsPaused");
142142
});
143143

144-
it("GIVEN an account with administrative role WHEN grantRole THEN transaction succeeds", async () => {
144+
it.only("GIVEN an account with administrative role WHEN grantRole THEN transaction succeeds", async () => {
145145
// check that C does not have the role
146146
let check_C = await asset.hasRole(ATS_ROLES.ROLE_PAUSER, unknownSigner.address);
147147
expect(check_C).to.equal(false);
@@ -168,7 +168,7 @@ export function accessControlTests(getCtx: () => AssetMockCtx): void {
168168
expect(membersFor_Pause[1].toUpperCase()).to.equal(unknownSigner.address.toUpperCase());
169169
});
170170

171-
it("GIVEN an account with administrative role WHEN revokeRole THEN transaction succeeds", async () => {
171+
it.only("GIVEN an account with administrative role WHEN revokeRole THEN transaction succeeds", async () => {
172172
// check that B has the role
173173
let check_B = await asset.hasRole(ATS_ROLES.ROLE_PAUSER, signer_B.address);
174174
expect(check_B).to.equal(true);
@@ -192,7 +192,7 @@ export function accessControlTests(getCtx: () => AssetMockCtx): void {
192192
expect(membersFor_Pause.length).to.equal(memberCountFor_Pause);
193193
});
194194

195-
it("GIVEN an account with pauser role WHEN renouncing the pauser role THEN transaction succeeds", async () => {
195+
it.only("GIVEN an account with pauser role WHEN renouncing the pauser role THEN transaction succeeds", async () => {
196196
// check that B has the role
197197
let check_B = await asset.hasRole(ATS_ROLES.ROLE_PAUSER, signer_B.address);
198198
expect(check_B).to.equal(true);
@@ -216,7 +216,7 @@ export function accessControlTests(getCtx: () => AssetMockCtx): void {
216216
expect(membersFor_Pause.length).to.equal(memberCountFor_Pause);
217217
});
218218

219-
it("GIVEN an account with administrative role WHEN applyRoles THEN transaction succeeds", async () => {
219+
it.only("GIVEN an account with administrative role WHEN applyRoles THEN transaction succeeds", async () => {
220220
// check that C does not have the role
221221
await asset.connect(deployer).grantRole(ATS_ROLES.ROLE_PAUSER, signer_C.address);
222222

@@ -256,7 +256,7 @@ export function accessControlTests(getCtx: () => AssetMockCtx): void {
256256
expect(membersFor_Default[1].toUpperCase()).to.equal(signer_C.address.toUpperCase());
257257
});
258258

259-
it("GIVEN an account with administrative role, if roles are duplicated but not contradictory WHEN applyRoles THEN transaction succeeds", async () => {
259+
it.only("GIVEN an account with administrative role, if roles are duplicated but not contradictory WHEN applyRoles THEN transaction succeeds", async () => {
260260
// check that C does not have the role
261261
await asset.connect(deployer).grantRole(ATS_ROLES.ROLE_PAUSER, signer_C.address);
262262

@@ -291,7 +291,7 @@ export function accessControlTests(getCtx: () => AssetMockCtx): void {
291291
expect(rolesFor_C[0].toUpperCase()).to.equal(ATS_ROLES.ROLE_PAUSER.toUpperCase());
292292
});
293293

294-
it("GIVEN a mixed batch of effective and no-op entries WHEN applyRoles THEN RolesApplied carries only the effectively changed entries in input order", async () => {
294+
it.only("GIVEN a mixed batch of effective and no-op entries WHEN applyRoles THEN RolesApplied carries only the effectively changed entries in input order", async () => {
295295
// Pre-state: signer_C holds ROLE_PAUSER and ROLE_AGENT, nothing else.
296296
await asset.connect(deployer).grantRole(ATS_ROLES.ROLE_PAUSER, signer_C.address);
297297
await asset.connect(deployer).grantRole(ATS_ROLES.ROLE_AGENT, signer_C.address);
@@ -325,7 +325,7 @@ export function accessControlTests(getCtx: () => AssetMockCtx): void {
325325
expect(await asset.hasRole(ATS_ROLES.ROLE_MATURITY_MANAGER, signer_C.address)).to.equal(false);
326326
});
327327

328-
it("GIVEN an account that already has a role WHEN grantRole is called again THEN transaction fails with AccountAssignedToRole", async () => {
328+
it.only("GIVEN an account that already has a role WHEN grantRole is called again THEN transaction fails with AccountAssignedToRole", async () => {
329329
// Grant the role first time
330330
await asset.connect(deployer).grantRole(ATS_ROLES.ROLE_PAUSER, unknownSigner.address);
331331

@@ -338,7 +338,7 @@ export function accessControlTests(getCtx: () => AssetMockCtx): void {
338338
.withArgs(ATS_ROLES.ROLE_PAUSER, unknownSigner.address);
339339
});
340340

341-
it("GIVEN an account without a specific role WHEN revokeRole is called THEN transaction fails with AccountNotAssignedToRole", async () => {
341+
it.only("GIVEN an account without a specific role WHEN revokeRole is called THEN transaction fails with AccountNotAssignedToRole", async () => {
342342
// Verify that the account does not have the role
343343
expect(await asset.hasRole(ATS_ROLES.ROLE_PAUSER, unknownSigner.address)).to.equal(false);
344344

@@ -348,7 +348,7 @@ export function accessControlTests(getCtx: () => AssetMockCtx): void {
348348
.withArgs(ATS_ROLES.ROLE_PAUSER, unknownSigner.address);
349349
});
350350

351-
it("GIVEN an account without a specific role WHEN renounceRole is called THEN transaction fails with AccountNotAssignedToRole", async () => {
351+
it.only("GIVEN an account without a specific role WHEN renounceRole is called THEN transaction fails with AccountNotAssignedToRole", async () => {
352352
// Verify that the account does not have the role
353353
expect(await asset.hasRole(ATS_ROLES.ROLE_PAUSER, unknownSigner.address)).to.equal(false);
354354

@@ -358,7 +358,7 @@ export function accessControlTests(getCtx: () => AssetMockCtx): void {
358358
.withArgs(ATS_ROLES.ROLE_PAUSER, unknownSigner.address);
359359
});
360360

361-
it("GIVEN the sole DEFAULT_ADMIN_ROLE holder WHEN renounceRole is called THEN transaction fails with CannotRenounceSoleAdmin", async () => {
361+
it.only("GIVEN the sole DEFAULT_ADMIN_ROLE holder WHEN renounceRole is called THEN transaction fails with CannotRenounceSoleAdmin", async () => {
362362
// Verify deployer is the only admin
363363
const memberCount = await asset.getRoleMemberCount(ATS_ROLES.DEFAULT_ADMIN_ROLE);
364364
expect(memberCount).to.equal(1);
@@ -370,7 +370,7 @@ export function accessControlTests(getCtx: () => AssetMockCtx): void {
370370
);
371371
});
372372

373-
it("GIVEN two DEFAULT_ADMIN_ROLE holders WHEN one renounces THEN transaction succeeds and one admin remains", async () => {
373+
it.only("GIVEN two DEFAULT_ADMIN_ROLE holders WHEN one renounces THEN transaction succeeds and one admin remains", async () => {
374374
// Grant DEFAULT_ADMIN_ROLE to signer_C so there are 2 admins
375375
await asset.connect(deployer).applyRoles([ATS_ROLES.DEFAULT_ADMIN_ROLE], [true], signer_C.address);
376376
expect(await asset.getRoleMemberCount(ATS_ROLES.DEFAULT_ADMIN_ROLE)).to.equal(2);
@@ -387,21 +387,21 @@ export function accessControlTests(getCtx: () => AssetMockCtx): void {
387387
});
388388

389389
describe("initializeAccessControl", () => {
390-
it("GIVEN a caller without DEFAULT_ADMIN_ROLE WHEN initializeAccessControl is called THEN it reverts with AccountHasNoRole", async () => {
390+
it.only("GIVEN a caller without DEFAULT_ADMIN_ROLE WHEN initializeAccessControl is called THEN it reverts with AccountHasNoRole", async () => {
391391
await expect(asset.connect(unknownSigner).initializeAccessControl())
392392
.to.be.revertedWithCustomError(asset, "AccountHasNoRole")
393393
.withArgs(unknownSigner.address, ATS_ROLES.DEFAULT_ADMIN_ROLE);
394394
});
395395

396-
it("GIVEN an already-initialised facet WHEN initializeAccessControl is called again THEN it reverts with FacetAlreadyRegistered", async () => {
396+
it.only("GIVEN an already-initialised facet WHEN initializeAccessControl is called again THEN it reverts with FacetAlreadyRegistered", async () => {
397397
await expect(asset.initializeAccessControl())
398398
.to.be.revertedWithCustomError(asset, "FacetAlreadyRegistered")
399399
.withArgs(RESOLVER_KEY_ACCESS_CONTROL, 1);
400400
});
401401
});
402402

403403
describe("initializeAccessControl event", () => {
404-
it("GIVEN a fresh deployment WHEN initializeAccessControl is called THEN it emits AccessControlInitialized", async () => {
404+
it.only("GIVEN a fresh deployment WHEN initializeAccessControl is called THEN it emits AccessControlInitialized", async () => {
405405
await asset.forceFacetNotRegistered(RESOLVER_KEY_ACCESS_CONTROL);
406406
await expect(asset.initializeAccessControl()).to.emit(asset, "AccessControlInitialized");
407407
});
@@ -412,25 +412,25 @@ export function accessControlTests(getCtx: () => AssetMockCtx): void {
412412
await asset.forceNonOperational();
413413
});
414414

415-
it("GIVEN non-operational WHEN grantRole is called THEN AssetNotOperational", async () => {
415+
it.only("GIVEN non-operational WHEN grantRole is called THEN AssetNotOperational", async () => {
416416
await expect(asset.grantRole(ATS_ROLES.DEFAULT_ADMIN_ROLE, unknownSigner.address))
417417
.to.be.revertedWithCustomError(asset, "AssetNotOperational")
418418
.withArgs(ASSET_MOCK_CONFIG_ID, 1);
419419
});
420420

421-
it("GIVEN non-operational WHEN revokeRole is called THEN AssetNotOperational", async () => {
421+
it.only("GIVEN non-operational WHEN revokeRole is called THEN AssetNotOperational", async () => {
422422
await expect(asset.revokeRole(ATS_ROLES.DEFAULT_ADMIN_ROLE, unknownSigner.address))
423423
.to.be.revertedWithCustomError(asset, "AssetNotOperational")
424424
.withArgs(ASSET_MOCK_CONFIG_ID, 1);
425425
});
426426

427-
it("GIVEN non-operational WHEN renounceRole is called THEN AssetNotOperational", async () => {
427+
it.only("GIVEN non-operational WHEN renounceRole is called THEN AssetNotOperational", async () => {
428428
await expect(asset.renounceRole(ATS_ROLES.DEFAULT_ADMIN_ROLE))
429429
.to.be.revertedWithCustomError(asset, "AssetNotOperational")
430430
.withArgs(ASSET_MOCK_CONFIG_ID, 1);
431431
});
432432

433-
it("GIVEN non-operational WHEN applyRoles is called THEN AssetNotOperational", async () => {
433+
it.only("GIVEN non-operational WHEN applyRoles is called THEN AssetNotOperational", async () => {
434434
await expect(asset.applyRoles([], [], unknownSigner.address))
435435
.to.be.revertedWithCustomError(asset, "AssetNotOperational")
436436
.withArgs(ASSET_MOCK_CONFIG_ID, 1);

0 commit comments

Comments
 (0)