<commit_before>/*global contract, config, it, assert, before*/
const Resolver = require('Embark/contracts/Resolver');

const namehash = require('eth-ens-namehash');
const address = '0x38ac14a9B6a7c8F9C46e4804074186c9F201D0A0';
const rootNode = namehash.hash('embark.eth');

config({
  contracts: {
    "ENSRegistry": {
      "args": []
    },
    "Resolver": {
      "args": ["$ENSRegistry"]
    },
    "FIFSRegistrar": {
      "args": ["$ENSRegistry", rootNode],
      "onDeploy": [
        `ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send().then(() => {
          ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send();
          Resolver.methods.setAddr('${rootNode}', '${address}').send().then(() => {
            global.ensTestReady = true;
          });
        });`
      ]
    }
  }
});

contract("ENS", function () {
  this.timeout(1000);

  before(function (done) {
  //   Wait for onDeploy to finish
    const wait = setInterval(() => {
      if (!global.ensTestReady) {
        return;
      }
      clearInterval(wait);
      done();
    }, 500);
  });

  it("should have registered embark.eth", async function () {
    const domainAddress = await Resolver.methods.addr(rootNode).call();
    assert.strictEqual(domainAddress, address);
  });
});
<commit_msg>use setInterval to wait for deploy complete<commit_after>/*global contract, config, it, assert, before*/
const Resolver = require('Embark/contracts/Resolver');

const namehash = require('eth-ens-namehash');
const address = '0x38ac14a9B6a7c8F9C46e4804074186c9F201D0A0';
const rootNode = namehash.hash('embark.eth');

config({
  contracts: {
    "ENSRegistry": {
      "args": []
    },
    "Resolver": {
      "args": ["$ENSRegistry"]
    },
    "FIFSRegistrar": {
      "args": ["$ENSRegistry", rootNode],
      "onDeploy": [
        `ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send().then(() => {
          ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send();
          Resolver.methods.setAddr('${rootNode}', '${address}').send().then(() => {
            global.ensTestReady = true;
          });
        });`
      ]
    }
  }
});

contract("ENS", function () {
  this.timeout(1000);

  before(function (done) {
  //   Wait for onDeploy to finish
    const wait = setInterval(() => {
      if (!global.ensTestReady) {
        return;
      }
      clearInterval(wait);
      done();
    });
  });

  it("should have registered embark.eth", async function () {
    const domainAddress = await Resolver.methods.addr(rootNode).call();
    assert.strictEqual(domainAddress, address);
  });
});

{'fraction_non_alphanumeric': 0.18047673098751418, 'fraction_numerical': 0.026106696935300794, 'mean_word_length': 3.0676923076923077, 'pattern_counts': {'":': 14, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3205883', 'n_tokens_mistral': 871, 'n_tokens_neox': 837, 'n_words': 143}