<commit_before>const assert = require("chai").assert;
const Artifactor = require("../");
const temp = require("temp").track();
const contract = require("truffle-contract");
const path = require("path");
const fs = require("fs");
const requireNoCache = require("require-nocache")(module);

const firstNetworkObj = {
  3: { address: "0xe6e1652a0397e078f434d6dda181b218cfd42e01" }
};
const secondNetworkObj = {
  2: { address: "0xe5e1652a0397e078f434d6dda181b218cfd42e01" }
};
const thirdNetworkObj = {
  2: { address: "0x6a90f4263739e4e20146ee4b5691d5b0fe5d48ec" }
};

const dirPath = temp.mkdirSync({
  dir: path.resolve("./"),
  prefix: "tmp-test-contract-"
});
const expected_filepath = path.join(dirPath, "Example.json");

describe("if artifact file doesn't already exist...", () => {
  it("...artifactor merges a passed network object to json", done => {
    // make sure the artifact file doesn't already exist
    assert(!fs.existsSync(expected_filepath));

    artifactor = new Artifactor(dirPath);

    artifactor
      .save({
        contractName: "Example",
        abi: [],
        bytecode: "0xabcdef",<commit_msg>reorder test logic<commit_after>const assert = require("chai").assert;
const Artifactor = require("../");
const temp = require("temp").track();
const contract = require("truffle-contract");
const path = require("path");
const fs = require("fs");
const requireNoCache = require("require-nocache")(module);

const firstNetworkObj = {
  3: { address: "0xe6e1652a0397e078f434d6dda181b218cfd42e01" }
};
const secondNetworkObj = {
  2: { address: "0xe5e1652a0397e078f434d6dda181b218cfd42e01" }
};
const thirdNetworkObj = {
  2: { address: "0x6a90f4263739e4e20146ee4b5691d5b0fe5d48ec" }
};

let dirPath, expected_filepath;

describe("if artifact file doesn't already exist...", () => {
  before(() => {
    dirPath = temp.mkdirSync({
      dir: path.resolve("./"),
      prefix: "tmp-test-contract-"
    });
    expected_filepath = path.join(dirPath, "Example.json");
  });
  it("...artifactor merges a passed network object to json", done => {
    // make sure the artifact file doesn't already exist
    assert(!fs.existsSync(expected_filepath));

    artifactor = new Artifactor(dirPath);

    artifactor
      .save({
        contractName: "Example",
        abi: [],
        bytecode: "0xabcdef",
{'fraction_non_alphanumeric': 0.15043103448275863, 'fraction_numerical': 0.07327586206896551, 'mean_word_length': 4.323394495412844, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '3426508', 'n_tokens_mistral': 882, 'n_tokens_neox': 787, 'n_words': 165}