<commit_before>import fs from "fs";
import path from "path";
import gql from "graphql-tag";

import { TruffleDB } from "truffle-db";


const fixturesDirectory = path.join(__dirname, "..", "artifacts", "test");

// minimal config
const config = {
  contracts_build_directory: path.join(fixturesDirectory, "build"),
  contracts_directory: path.join(fixturesDirectory, "compilationSources"),
  all: true
};

const db = new TruffleDB(config);

const  Build = require(path.join(fixturesDirectory, "build", "SimpleStorage.json"));

const Load = gql `
  mutation LoadArtifacts {
    loaders {
      artifactsLoad {
        success
      }
    }
  }
` 

it("loads artifacts and returns true ", async () => {
  const {
    data: {
      loaders: {
        artifactsLoad: {
          success
        }
      }
    }
  } = await db.query(Load);
  expect(success).toEqual(true); 
});<commit_msg>Add mocking of manual compilation to loader test file<commit_after>import fs from "fs";
import path from "path";
import gql from "graphql-tag";
import { TruffleDB } from "truffle-db";
import * as Contracts from "truffle-workflow-compile";

jest.mock("truffle-workflow-compile", () => ({
 compile: function(config, callback) {
   const magicSquare= require(path.join(__dirname,"..", "artifacts", "test", "sources", "MagicSquare.json"));
   const migrations = require(path.join(__dirname, "..", "artifacts", "test", "sources", "Migrations.json"));
   const squareLib = require(path.join(__dirname, "..", "artifacts", "test", "sources", "SquareLib.json"));
   callback(null, {
     "contracts": [{
       "contract_name": "MagicSquare",
       ...magicSquare
     },
     {
       "contract_name": "Migrations",
       ...migrations
     },
     {
       "contract_name": "SquareLib",
       ...squareLib
     }
     ]
   });
 }
}));

const fixturesDirectory = path.join(__dirname, "..", "artifacts", "test");

// minimal config
const config = {
  contracts_build_directory: path.join(fixturesDirectory, "sources"),
  contracts_directory: path.join(fixturesDirectory, "compilationSources"),
  all: true
};

const db = new TruffleDB(config);

const Load = gql `
  mutation LoadArtifacts {
    loaders {
      artifactsLoad {
        success
      }
    }
  }
`

it("loads artifacts and returns true ", async () => {
  const {
    data: {
      loaders: {
        artifactsLoad: {
          success
        }
      }
    }
  } = await db.query(Load);
  expect(success).toEqual(true);
});
{'fraction_non_alphanumeric': 0.15172413793103448, 'fraction_numerical': 0.0, 'mean_word_length': 3.130653266331658, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 6, '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': '4143895', 'n_tokens_mistral': 781, 'n_tokens_neox': 779, 'n_words': 172}