Strings.test.js 750 B

12345678910111213141516171819202122232425
  1. const { constants } = require('@openzeppelin/test-helpers');
  2. const { expect } = require('chai');
  3. const StringsMock = artifacts.require('StringsMock');
  4. contract('Strings', function (accounts) {
  5. beforeEach(async function () {
  6. this.strings = await StringsMock.new();
  7. });
  8. describe('from uint256', function () {
  9. it('converts 0', async function () {
  10. expect(await this.strings.fromUint256(0)).to.equal('0');
  11. });
  12. it('converts a positive number', async function () {
  13. expect(await this.strings.fromUint256(4132)).to.equal('4132');
  14. });
  15. it('converts MAX_UINT256', async function () {
  16. expect(await this.strings.fromUint256(constants.MAX_UINT256)).to.equal(constants.MAX_UINT256.toString());
  17. });
  18. });
  19. });