EnumerableSet.test.js 1001 B

123456789101112131415161718192021222324252627282930313233
  1. const { accounts, contract } = require('@openzeppelin/test-environment');
  2. const { BN } = require('@openzeppelin/test-helpers');
  3. const EnumerableAddressSetMock = contract.fromArtifact('EnumerableAddressSetMock');
  4. const EnumerableUintSetMock = contract.fromArtifact('EnumerableUintSetMock');
  5. const { shouldBehaveLikeSet } = require('./EnumerableSet.behavior');
  6. describe('EnumerableSet', function () {
  7. // AddressSet
  8. describe('EnumerableAddressSet', function () {
  9. const [ accountA, accountB, accountC ] = accounts;
  10. beforeEach(async function () {
  11. this.set = await EnumerableAddressSetMock.new();
  12. });
  13. shouldBehaveLikeSet(accountA, accountB, accountC);
  14. });
  15. // UintSet
  16. describe('EnumerableUintSet', function () {
  17. const uintA = new BN('1234');
  18. const uintB = new BN('5678');
  19. const uintC = new BN('9101112');
  20. beforeEach(async function () {
  21. this.set = await EnumerableUintSetMock.new();
  22. });
  23. shouldBehaveLikeSet(uintA, uintB, uintC);
  24. });
  25. });