SafeERC20.test.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. const shouldFail = require('../../helpers/shouldFail');
  2. require('chai')
  3. .should();
  4. const SafeERC20Helper = artifacts.require('SafeERC20Helper');
  5. contract('SafeERC20', function () {
  6. beforeEach(async function () {
  7. this.helper = await SafeERC20Helper.new();
  8. });
  9. it('should throw on failed transfer', async function () {
  10. await shouldFail.reverting(this.helper.doFailingTransfer());
  11. });
  12. it('should throw on failed transferFrom', async function () {
  13. await shouldFail.reverting(this.helper.doFailingTransferFrom());
  14. });
  15. it('should throw on failed approve', async function () {
  16. await shouldFail.reverting(this.helper.doFailingApprove());
  17. });
  18. it('should not throw on succeeding transfer', async function () {
  19. await this.helper.doSucceedingTransfer();
  20. });
  21. it('should not throw on succeeding transferFrom', async function () {
  22. await this.helper.doSucceedingTransferFrom();
  23. });
  24. it('should not throw on succeeding approve', async function () {
  25. await this.helper.doSucceedingApprove();
  26. });
  27. });