{"id":14970714,"url":"https://github.com/openzeppelin/openzeppelin-test-helpers","last_synced_at":"2025-07-24T21:09:24.496Z","repository":{"id":38360161,"uuid":"159831009","full_name":"OpenZeppelin/openzeppelin-test-helpers","owner":"OpenZeppelin","description":"Assertion library for Ethereum smart contract testing","archived":false,"fork":false,"pushed_at":"2024-03-07T15:58:33.000Z","size":1342,"stargazers_count":414,"open_issues_count":42,"forks_count":132,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-05-29T12:48:40.931Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.openzeppelin.com/test-helpers","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpenZeppelin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-30T13:57:15.000Z","updated_at":"2025-05-28T15:22:44.000Z","dependencies_parsed_at":"2024-01-11T23:23:05.177Z","dependency_job_id":"13fadbaf-cd78-4156-8209-fccd8eb1c199","html_url":"https://github.com/OpenZeppelin/openzeppelin-test-helpers","commit_stats":{"total_commits":253,"total_committers":31,"mean_commits":8.161290322580646,"dds":"0.41501976284584985","last_synced_commit":"ae72538763f5e39df775877876c05992aa698c74"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"purl":"pkg:github/OpenZeppelin/openzeppelin-test-helpers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Fopenzeppelin-test-helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Fopenzeppelin-test-helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Fopenzeppelin-test-helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Fopenzeppelin-test-helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenZeppelin","download_url":"https://codeload.github.com/OpenZeppelin/openzeppelin-test-helpers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Fopenzeppelin-test-helpers/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266904467,"owners_count":24004109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T13:44:01.744Z","updated_at":"2025-07-24T21:09:24.447Z","avatar_url":"https://github.com/OpenZeppelin.png","language":"JavaScript","readme":"# OpenZeppelin Test Helpers\n\n[![Docs](https://img.shields.io/badge/docs-%F0%9F%93%84-blue)](https://docs.openzeppelin.com/test-helpers)\n[![NPM Package](https://img.shields.io/npm/v/@openzeppelin/test-helpers.svg)](https://www.npmjs.org/package/@openzeppelin/test-helpers)\n[![Build Status](https://travis-ci.com/OpenZeppelin/openzeppelin-test-helpers.svg?branch=master)](https://travis-ci.com/OpenZeppelin/openzeppelin-test-helpers)\n\n**Assertion library for Ethereum smart contract testing.** Make sure your contracts behave as expected.\n\n * Check that [transactions revert](https://docs.openzeppelin.com/test-helpers/api#expect-revert) for the correct reason\n * Verify that [events](https://docs.openzeppelin.com/test-helpers/api#expect-event) were emitted with the right values\n * Track [balance changes](https://docs.openzeppelin.com/test-helpers/api#balance) elegantly\n * Handle [very large numbers](https://docs.openzeppelin.com/test-helpers/api#bn)\n * Simulate the [passing of time](https://docs.openzeppelin.com/test-helpers/api#time)\n\n## Overview\n\n### Installation\n\n```bash\nnpm install --save-dev @openzeppelin/test-helpers\n```\n\n#### Hardhat\n\nInstall `web3` and the `hardhat-web3` plugin.\n\n```\nnpm install --save-dev @nomiclabs/hardhat-web3 web3\n```\n\nRemember to include the plugin in your configuration as explained in the [installation instructions](https://hardhat.org/plugins/nomiclabs-hardhat-web3.html#installation).\n\n### Usage\n\nImport `@openzeppelin/test-helpers` in your test files to access the different assertions and utilities.\n\n```javascript\nconst {\n  BN,           // Big Number support\n  constants,    // Common constants, like the zero address and largest integers\n  expectEvent,  // Assertions for emitted events\n  expectRevert, // Assertions for transactions that should fail\n} = require('@openzeppelin/test-helpers');\n\nconst ERC20 = artifacts.require('ERC20');\n\ncontract('ERC20', function ([sender, receiver]) {\n  beforeEach(async function () {\n    // The bundled BN library is the same one web3 uses under the hood\n    this.value = new BN(1);\n\n    this.erc20 = await ERC20.new();\n  });\n\n  it('reverts when transferring tokens to the zero address', async function () {\n    // Conditions that trigger a require statement can be precisely tested\n    await expectRevert(\n      this.erc20.transfer(constants.ZERO_ADDRESS, this.value, { from: sender }),\n      'ERC20: transfer to the zero address',\n    );\n  });\n\n  it('emits a Transfer event on successful transfers', async function () {\n    const receipt = await this.erc20.transfer(\n      receiver, this.value, { from: sender }\n    );\n\n    // Event assertions can verify that the arguments are the expected ones\n    expectEvent(receipt, 'Transfer', {\n      from: sender,\n      to: receiver,\n      value: this.value,\n    });\n  });\n\n  it('updates balances on successful transfers', async function () {\n    this.erc20.transfer(receiver, this.value, { from: sender });\n\n    // BN assertions are automatically available via chai-bn (if using Chai)\n    expect(await this.erc20.balanceOf(receiver))\n      .to.be.bignumber.equal(this.value);\n  });\n});\n```\n\n## Learn More\n\n* Head to [Configuration](https://docs.openzeppelin.com/test-helpers/configuration) for advanced settings.\n* For detailed usage information, take a look at the [API Reference](https://docs.openzeppelin.com/test-helpers/api).\n\n\n## License\n\n[MIT](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenzeppelin%2Fopenzeppelin-test-helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenzeppelin%2Fopenzeppelin-test-helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenzeppelin%2Fopenzeppelin-test-helpers/lists"}