{"_id":"@audits/truffle-test-generator","_rev":"3-3ffedb6c25923fd0ea0ff2fdd2cdb5a9","name":"@audits/truffle-test-generator","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@audits/truffle-test-generator","author":{"name":"Thomas Hodges","url":"thomas@audits.dev"},"version":"1.0.0","description":"A test file generator for the Truffle framework","bin":{"ttg":"./testGen.js"},"keywords":["solidity","truffle","test","generator","ethereum"],"homepage":"https://audits.dev","repository":{"type":"git","url":"git+https://github.com/audits-dev/truffle-test-generator.git"},"license":"MIT","dependencies":{"fs":"0.0.1-security"},"gitHead":"046b7b6106927a0756faf927239d88c287257281","bugs":{"url":"https://github.com/audits-dev/truffle-test-generator/issues"},"_id":"@audits/truffle-test-generator@1.0.0","_nodeVersion":"11.12.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-MDq6U6TAYdVGIWN1PckH3L5FS0XibZ3/Et617ICj92A3t0D674j2a9XDX1NMIHZJo8ei7Ovh8YNwkywhyvQbOQ==","shasum":"c23765596e876ee06f8430cbb5016328fc52de3e","tarball":"https://registry.npmjs.org/@audits/truffle-test-generator/-/truffle-test-generator-1.0.0.tgz","fileCount":4,"unpackedSize":4566,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcxLyiCRA9TVsSAnZWagAAj18P/ikhoalEePYMwwSV+tEY\ndHUcmcHQAK3OJDxJs8SoH2H9r+vWceC4yVNhWiqUePdBb9LY0tcN3TU3X1Lq\nlZWjYuS0HhepDNcLhelB6uI+nWyORkTx921Qpj9c91Na8woAzam49VXmVGEO\n9tI31/X52Rcy9g6cV5WE8T942bxK0YWeUP8VsW0Jm6AWL9de1gR80LVuhUfJ\nzOvdeoouXNP0c/qn9PSvihGX+WvYCkQwuyi2bLwyk+LAIdqxptQYIZmCc0qb\nV9hK9boS1OGiodtj4Memtnao+SfqqUzqB+LnZieQQxP5ksPfEOjIBkgx3C7f\nEmIiBMGgCnO3uOv5OD05DDfRx9z59C4N1WLrtVa6xJHvrnENpzdu482XBzG5\nQhEV0gGksiFYG2L9PN4HzB8uByiUC9s4tgggvvf7vkGbrc2fwB67JMnjXV+M\nXudyeP9Y7q6QTXnqDahT0+kdbhdRaeC+OjPq4JaepZkDRrNbUnfkIvEsFK4I\n/9fI2j31wVoQA4Tuzu6ECruEeNNEiSkbROjd5GQa8Rw/oRSC85/xQubJxxs3\naUo+BNVXTUSLnojgrjcCo4IFdQb7ljffotWx2kGjMwMvv6kD0d4hAYTluKlT\nulZYTO/wSRbnQYAwJyECoiBEFWfSd63w2SOofTUNGYS7ZZlPwZR6ueKQLaQr\nF6eM\r\n=rESI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCy2dtYE2SkEFOXLDZabd/MovmwgmRqfv7cq0JbQWmIKwIgRkRBjkQoCh8Qtq7Yf6pCfHtO2fQF7Mg0jfxNNza7Blk="}]},"maintainers":[{"name":"thodges","email":"thomas@smartcontract.com"}],"_npmUser":{"name":"thodges","email":"thomas@smartcontract.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/truffle-test-generator_1.0.0_1556397217989_0.6186780709793704"},"_hasShrinkwrap":false,"deprecated":"Old"},"1.0.1":{"name":"@audits/truffle-test-generator","author":{"name":"Thomas Hodges","url":"thomas@audits.dev"},"version":"1.0.1","description":"A test file generator for the Truffle framework","bin":{"ttg":"./testGen.js"},"keywords":["solidity","truffle","test","generator","ethereum"],"homepage":"https://audits.dev","repository":{"type":"git","url":"git+https://github.com/audits-dev/truffle-test-generator.git"},"license":"MIT","dependencies":{"fs":"0.0.1-security"},"gitHead":"d0f308d14507326a36a087c4a5f16e71a6f38a0f","bugs":{"url":"https://github.com/audits-dev/truffle-test-generator/issues"},"_id":"@audits/truffle-test-generator@1.0.1","_nodeVersion":"11.12.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-siK9wk6spokz3upwXzxn13FmC0PzUjl1LFPx00NpRyGyIdLz7qawFjS4PJMAOkAtmXhk1ulQxAtUcY+tOuOfPg==","shasum":"010b74ae985745c7f019fdbb50d16d1765e4750f","tarball":"https://registry.npmjs.org/@audits/truffle-test-generator/-/truffle-test-generator-1.0.1.tgz","fileCount":4,"unpackedSize":6762,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcxMSDCRA9TVsSAnZWagAA8ZAP/2rXICIZG/uYsX91kNk6\na3m82Uh799ZbMefgSg86ZyMj8pN7sqlXBqY2DaWlFh4su5LefVenNAe8C8/M\nUqTGvkWW6wJMRwMrjLj3To5TSfsWH6T89uEvZYVfxu5Ajg04+/rslodDKeCp\nRBsNOdnY8JCqN8d1JYKYqaeWDA6h4D/nXaFzeWrFQK988Ra+hVkNj5QDHJub\nlFCVgnQm8EN3nV4NqVUxH4oMM70yg1W1uFrpZgmcUHuAR3LWuqnKOQxxI0rF\nkVOZGktJTjd/xKoRIs7o4DFjNcNm36Baey47WcZ3OLMBTX+B0ZXiz1+P/iVG\nDPEyWxIouO7VsFAemxIHmCCO3iRO+CG1dn4PSIkwKPlXyzyY4izw9MTP97d4\nrsCsQbmXo8RaxNtJzZwn8Qi5YhS2ro0bnBCwBZXdpkjWgDgRb2wQonVI5whq\nyeSIXzRc3A2HcZOsRYX981YhbJg8wrcbeEsYToqqdFV5CmvYG+Pc+jpY57Co\ngdCnykfSlxm1CpJyETrEO/GNRaeQpOmRrLZUXyzDQy1YBHX2n6XBYZNaWHxa\nP0MVmwKPlQfVQNjlOa0opXX16lqmJXR7bRL3iCUukKZQiZLFF5M/UBviGh6J\nvppeLnrPdGLIRBJFc71um2vNrEVWiKGxPkgaXJMcNw6q4rDiv45fGx+1rh+6\nPRnk\r\n=o6x/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCu1QoaRWM/ZpXvR+D0fb9BjTC3jWDUsLpgYBHPIezTOgIgI+zegmOLLz3eg4++dATyrYUAFLboM/TretfGlkCDUCo="}]},"maintainers":[{"name":"thodges","email":"thomas@smartcontract.com"}],"_npmUser":{"name":"thodges","email":"thomas@smartcontract.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/truffle-test-generator_1.0.1_1556399234840_0.028770215115612396"},"_hasShrinkwrap":false}},"time":{"created":"2019-04-27T20:33:37.796Z","1.0.0":"2019-04-27T20:33:38.113Z","modified":"2022-04-04T16:22:53.301Z","1.0.1":"2019-04-27T21:07:14.975Z"},"maintainers":[{"name":"thodges","email":"thomas@smartcontract.com"}],"description":"A test file generator for the Truffle framework","homepage":"https://audits.dev","keywords":["solidity","truffle","test","generator","ethereum"],"repository":{"type":"git","url":"git+https://github.com/audits-dev/truffle-test-generator.git"},"author":{"name":"Thomas Hodges","url":"thomas@audits.dev"},"bugs":{"url":"https://github.com/audits-dev/truffle-test-generator/issues"},"license":"MIT","readme":"# Truffle Test Generator\n\nA utility for creating new test files in a Truffle project.\n\n## Install\n\n```\nnpm i @audits/truffle-test-generator --save-dev\n```\n\n## Usage\n\nUse Truffle to compile your contracts first.\n\n```\ntruffle compile\n```\n\nGenerate tests for a contract named MyContract.\n\n```\nnpx ttg MyContract\n```\n\n_Replace MyContract with the name of the contract you want to create tests for._\n\n## How It Works\n\nThe test generator will look at the json files located in the `./build/contracts` directory for the given contract name. As long as that contract exists and has been compiled, a test file will be created for it.\n\nEach test will include a standard template for the beginning of the file, which includes `require`ing the artifact, declaring the contract test, and setting some common account variables.\n\n```javascript\nconst MyChildContract = artifacts.require('MyChildContract')\n\ncontract('MyChildContract', (accounts) => {\n  const maintainer = accounts[0]\n  const user1 = accounts[1]\n  const user2 = accounts[2]\n  const stranger = accounts[3]\n\n  let mychildcontract\n```\n\nWhile reading the contract's json file, it will also generate input parameters for your constructor. However, it will be up to you to update the values as your contract requires.\n\n```javascript\n// Be sure to update these constructor values\nlet _initialParentValue = 0\nlet _initialChildValue = 0\n\nbeforeEach(async () => {\n  mychildcontract = await MyChildContract.new(_initialParentValue, _initialChildValue, {from: maintainer})\n})\n```\n\nAny inherited contracts with external or public functions will have a test stub (as a describe block) created for it.\n\n```javascript\ndescribe('setValue', () => {\n\n})\n```\n\nThis allows you to easily have a structure for your tests and ensure that each external/public method will be tested, provided you write a test for it.\n\nThe test file will be placed in the `test` directory within your Truffle project and named `MyContract_test.js`, where MyContract is the name of the contract. In order to prevent a user from accidentally erasing an existing file, `-new` will be appended to the name and a new file will be created if the filename already exists. If the `-new` file exists, it will be overwritten.","readmeFilename":"README.md"}