浏览代码

Update Test Helpers to 0.5.6 (#2261)

* update test-helpers to 0.5.6-rc.0

* remove comment that no longer applies

* fix uses of expectEvent.notEmitted

* remove mocha only

* update to final version

* Update test/token/ERC777/ERC777.test.js

Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>

Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
Francisco Giordano 5 年之前
父节点
当前提交
ccfd370b89
共有 4 个文件被更改,包括 25 次插入13 次删除
  1. 17 5
      package-lock.json
  2. 1 1
      package.json
  3. 5 5
      test/access/AccessControl.test.js
  4. 2 2
      test/token/ERC777/ERC777.test.js

+ 17 - 5
package-lock.json

@@ -2053,13 +2053,13 @@
       }
     },
     "@openzeppelin/test-helpers": {
-      "version": "0.5.5",
-      "resolved": "https://registry.npmjs.org/@openzeppelin/test-helpers/-/test-helpers-0.5.5.tgz",
-      "integrity": "sha512-jTSCQojQ0Q7FBMN3Me7o0OIVuRnfHRR9TcE+ZlfbSfdqrHkFLwSfeDHSNWtQGlF1xPQR5r3iRI0ccsCrN+JblA==",
+      "version": "0.5.6",
+      "resolved": "https://registry.npmjs.org/@openzeppelin/test-helpers/-/test-helpers-0.5.6.tgz",
+      "integrity": "sha512-8U4sR4ed4cFmc6UKj7akUxZzQJKU9P3p/3RbF+urQuRLLhBaB8zSya1m9VB7/anYEZnBmTDk8LuVgAmYaCPs9A==",
       "dev": true,
       "requires": {
         "@openzeppelin/contract-loader": "^0.4.0",
-        "@truffle/contract": "^4.0.35",
+        "@truffle/contract": "^4.0.35 <4.2.2",
         "ansi-colors": "^3.2.3",
         "chai": "^4.2.0",
         "chai-bn": "^0.2.1",
@@ -4429,7 +4429,8 @@
     "acorn": {
       "version": "7.1.0",
       "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
-      "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ=="
+      "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==",
+      "dev": true
     },
     "acorn-jsx": {
       "version": "5.1.0",
@@ -8893,6 +8894,11 @@
             "negotiator": "0.6.2"
           }
         },
+        "acorn": {
+          "version": "7.1.0",
+          "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
+          "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ=="
+        },
         "acorn-jsx": {
           "version": "5.1.0",
           "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz",
@@ -21707,6 +21713,7 @@
             "@webassemblyjs/helper-module-context": "1.8.5",
             "@webassemblyjs/wasm-edit": "1.8.5",
             "@webassemblyjs/wasm-parser": "1.8.5",
+            "acorn": "^6.2.1",
             "ajv": "^6.10.2",
             "ajv-keywords": "^3.4.1",
             "chrome-trace-event": "^1.0.2",
@@ -21727,6 +21734,11 @@
             "webpack-sources": "^1.4.1"
           },
           "dependencies": {
+            "acorn": {
+              "version": "6.4.0",
+              "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz",
+              "integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw=="
+            },
             "cacache": {
               "version": "12.0.3",
               "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.3.tgz",

+ 1 - 1
package.json

@@ -50,7 +50,7 @@
     "@openzeppelin/gsn-helpers": "^0.2.3",
     "@openzeppelin/gsn-provider": "^0.1.10",
     "@openzeppelin/test-environment": "^0.1.4",
-    "@openzeppelin/test-helpers": "^0.5.5",
+    "@openzeppelin/test-helpers": "^0.5.6",
     "chai": "^4.2.0",
     "eslint": "^6.5.1",
     "eslint-config-standard": "^14.1.1",

+ 5 - 5
test/access/AccessControl.test.js

@@ -49,7 +49,7 @@ describe('AccessControl', function () {
     it('accounts can be granted a role multiple times', async function () {
       await this.accessControl.grantRole(ROLE, authorized, { from: admin });
       const receipt = await this.accessControl.grantRole(ROLE, authorized, { from: admin });
-      await expectEvent.not.inTransaction(receipt.tx, AccessControlMock, 'RoleGranted');
+      expectEvent.notEmitted(receipt, 'RoleGranted');
     });
   });
 
@@ -58,7 +58,7 @@ describe('AccessControl', function () {
       expect(await this.accessControl.hasRole(ROLE, authorized)).to.equal(false);
 
       const receipt = await this.accessControl.revokeRole(ROLE, authorized, { from: admin });
-      await expectEvent.not.inTransaction(receipt.tx, AccessControlMock, 'RoleRevoked');
+      expectEvent.notEmitted(receipt, 'RoleRevoked');
     });
 
     context('with granted role', function () {
@@ -84,7 +84,7 @@ describe('AccessControl', function () {
         await this.accessControl.revokeRole(ROLE, authorized, { from: admin });
 
         const receipt = await this.accessControl.revokeRole(ROLE, authorized, { from: admin });
-        await expectEvent.not.inTransaction(receipt.tx, AccessControlMock, 'RoleRevoked');
+        expectEvent.notEmitted(receipt, 'RoleRevoked');
       });
     });
   });
@@ -92,7 +92,7 @@ describe('AccessControl', function () {
   describe('renouncing', function () {
     it('roles that are not had can be renounced', async function () {
       const receipt = await this.accessControl.renounceRole(ROLE, authorized, { from: authorized });
-      await expectEvent.not.inTransaction(receipt.tx, AccessControlMock, 'RoleRevoked');
+      expectEvent.notEmitted(receipt, 'RoleRevoked');
     });
 
     context('with granted role', function () {
@@ -118,7 +118,7 @@ describe('AccessControl', function () {
         await this.accessControl.renounceRole(ROLE, authorized, { from: authorized });
 
         const receipt = await this.accessControl.renounceRole(ROLE, authorized, { from: authorized });
-        await expectEvent.not.inTransaction(receipt.tx, AccessControlMock, 'RoleRevoked');
+        expectEvent.notEmitted(receipt, 'RoleRevoked');
       });
     });
   });

+ 2 - 2
test/token/ERC777/ERC777.test.js

@@ -60,8 +60,8 @@ describe('ERC777', function () {
       });
     });
 
-    it.skip('does not emit AuthorizedOperator events for default operators', async function () {
-      expectEvent.not.inConstructor(this.token, 'AuthorizedOperator'); // This helper needs to be implemented
+    it('does not emit AuthorizedOperator events for default operators', async function () {
+      await expectEvent.notEmitted.inConstruction(this.token, 'AuthorizedOperator');
     });
 
     describe('basic information', function () {