<commit_before>import hooks from 'hooks';

import Anime from '../src/models/Anime';
import Movie from '../src/models/Movie';
import Show from '../src/models/Show';

import animeData from './anime.json';
import novieData from './movie.json';
import showData from './show.json';

hooks.beforeAll(async(transaction, done) => {
  try {
    const anime = await new Anime(animeData).save();
    const movie = await new Movie(movieData).save();
    const show = await new Anime(showData).save();

    done();
  } catch (err) {
    hoosk.error(err);
  }
});

hooks.before('Logs > Error Logs > Get Error Logs', transaction => {
  transaction.skip = true;
});

hooks.before('Export > Export > Export Collection', transaction => {
  transaction.skip = true;
});



// copyTestFiles() {
//   const animePath = path.join(process.cwd(), "test/anime.json");
//   const moviePath = path.join(process.cwd(), "test/movie.json");
//   const showPath = path.join(process.cwd(), "test/show.json");
//
//   const animeNewPath = path.join(tempDir, "animes.json");
//   const movieNewPath = path.join(tempDir, "movies.json");
//   const showNewPath = path.join(tempDir, "shows.json");
//
//   const animeExists = fs.existsSync(animePath);
//   const movieExists = fs.existsSync(moviePath);
//   const showExists = fs.existsSync(showPath);
//
//   if (animeExists && movieExists && showExists) {
//     fse.copySync(animePath, animeNewPath);
//     fse.copySync(moviePath, movieNewPath);
//     fse.copySync(showPath, showNewPath);
//
//     fs.writeFileSync(path.join(tempDir, `${name}.log`), JSON.stringify({
//       "name":"popcorn-api",
//       "pid": 2809,
//       "level": "error",
//       "msg": "Trakt: Could not find any data on: /shows/tt1517514?extended=full with slug: 'tt1517514'",
//       "time": "2016-11-19T16:53:54.968Z"
//     }));
//   } else {
//     throw new Error('A test file could not be found!');
//   }
// }<commit_msg>updated hooks<commit_after>import hooks from 'hooks';
import Util from '../src/Util';

import Anime from '../src/models/Anime';
import Movie from '../src/models/Movie';
import Show from '../src/models/Show';

import animeData from './anime.json';
import movieData from './movie.json';
import showData from './show.json';

hooks.beforeAll((transaction, done) => {
  const util = new Util();

  const anime = util.executeCommand('NODE_ENV=test ../build/popcorn-api.js -i ../test/anime.json');
  const movie = util.executeCommand('NODE_ENV=test ../build/popcorn-api.js -i ../test/movie.json');
  const show = util.executeCommand('NODE_ENV=test ../build/popcorn-api.js -i ../test/show.json');

  Promise.all([anime, movie, show])
    .then(res => done())
    .catch(err => done(err));
});

hooks.before('Logs > Error Logs > Get Error Logs', transaction => {
  transaction.skip = true;
});

hooks.before('Export > Export > Export Collection', transaction => {
  transaction.skip = true;
});
{'fraction_non_alphanumeric': 0.18722088629336997, 'fraction_numerical': 0.01202335967021642, 'mean_word_length': 3.432267884322679, 'pattern_counts': {'":': 5, '<': 3, '<?xml version=': 0, '>': 19, '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': '3773334', 'n_tokens_mistral': 996, 'n_tokens_neox': 956, 'n_words': 222}