<commit_before>describe('MALjs suite', () => {
  var mal;

  beforeEach(function() {
    mal = new MALjs(_ENV.user, _ENV.password);
  });

  it('should be able to set credentials', () => {
    expect(mal.user).toBe(_ENV.user);
    expect(mal.password).toBe(_ENV.password);
  });

  describe('search()', () => {
    var failed;
    var response;

    beforeEach((done) => {
      mal = new MALjs(_ENV.user, _ENV.password);
      mal.search('full metal')
        .then(result => {
          failed = false;
          response = result;
          console.log('success:', result);
          done();
        })
        .catch(err => {
          failed = true;
          console.log('error:', err);
          done();
        });
    });

    it('should be able to search an anime', () => {
      expect(failed).toBe(false);
    });

    it('should return a json response on success', () => {
      expect(typeof response).toBe('object');
    });

    it('should contain an anime item', () => {
      expect(typeof response.anime).toBe('object');
      expect(response.anime.entry.length).toBeGreaterThan(0);
    });

  });

  describe('verifyCredentials()', () => {
    var failed;
    var response;

    beforeEach((done) => {
      mal = new MALjs(_ENV.user, _ENV.password);
      mal.verifyCredentials()
        .then(result => {
          failed = false;
          response = result;
          console.log('success:', result);
          done();
        })
        .catch(err => {
          failed = true;
          console.log('error:', err);
          done();
        });
    });

    it('should be able to retrieve user details', () => {
      expect(failed).toBe(false);
    });
  });

  describe('list()', () => {
    var failed;
    var response;

    beforeEach((done) => {
      mal = new MALjs(_ENV.user, _ENV.password);
      mal.list()
        .then(result => {
          failed = false;
          response = result;
          console.log('success:', result);
          done();
        })
        .catch(err => {
          failed = true;
          console.log('error:', err);
          done();
        });
    });

    it('should be able to retrieve user anime list', () => {
      expect(failed).toBe(false);
    });
  });

  describe('add()', () => {
    var failed;
    var response;

    beforeEach((done) => {
      mal = new MALjs(_ENV.user, _ENV.password);

      mal.add('71', {
        "episode": "1",
        "status": "6",
        "score": "7"
      })
      .then(results => {
        return mal.list();
      })
      .then(results => {
        console.log(results);
        failed = false;
        response = results;
        done();
      })
      .catch(err => {
        failed = true;
        console.log('error:', err);
        done();
      });
    });

    it('should be able to add an anime to the list', () => {
      expect(failed).toBe(false);
      expect(response.myanimelist).toBeDefined();
      expect(response.myanimelist.anime.series_animedb_id).toBe('71');
      expect(response.myanimelist.anime.my_status).toBe('6');
      expect(response.myanimelist.anime.my_watched_episodes).toBe('1');
    });
  });

  describe('update()', () => {
    var failed;
    var response;

    beforeEach((done) => {
      mal = new MALjs(_ENV.user, _ENV.password);

      mal.update('71', {
        "episode": "2",
        "status": "1",
        "score": "7"
      })
      .then(results => {
        return mal.list();
      })
      .then(results => {
        console.log(results);
        failed = false;
        response = results;
        done();
      })
      .catch(err => {
        failed = true;
        console.log('error:', err);
        done();
      });
    });

    it('should be able to update an anime to the list', () => {
      expect(failed).toBe(false);
      expect(response.myanimelist).toBeDefined();
      expect(response.myanimelist.anime.series_animedb_id).toBe('71');
      expect(response.myanimelist.anime.my_status).toBe('1');
      expect(response.myanimelist.anime.my_watched_episodes).toBe('2');
    });
  });

  describe('delete()', () => {
    var failed;
    var response;

    beforeEach((done) => {
      mal = new MALjs(_ENV.user, _ENV.password);

      mal.delete('71')
      .then(results => {
        return mal.list();
      })
      .then(results => {
        console.log(results);
        failed = false;
        response = results;
        done();
      })
      .catch(err => {
        failed = true;
        console.log('error:', err);
        done();
      });
    });

    it('should be able to delete an anime from the list', () => {
      expect(failed).toBe(false);
      expect(response.myanimelist.anime).not.toBeDefined();
    });
  });

});
<commit_msg>test an exception when class is initatied witout credentials<commit_after>describe('MALjs suite', () => {
  var mal;

  beforeEach(function() {
    mal = new MALjs(_ENV.user, _ENV.password);
  });

  it('should be able to set credentials', () => {
    expect(mal.user).toBe(_ENV.user);
    expect(mal.password).toBe(_ENV.password);
  });

  it('should throw an exception when passing in no credentials', function() {
    expect(function() {
      new MALjs(_ENV.user);
    }).toThrow();
  });

  describe('search()', () => {
    var failed;
    var response;

    beforeEach((done) => {
      mal = new MALjs(_ENV.user, _ENV.password);
      mal.search('full metal')
        .then(result => {
          failed = false;
          response = result;
          console.log('success:', result);
          done();
        })
        .catch(err => {
          failed = true;
          console.log('error:', err);
          done();
        });
    });

    it('should be able to search an anime', () => {
      expect(failed).toBe(false);
    });

    it('should return a json response on success', () => {
      expect(typeof response).toBe('object');
    });

    it('should contain an anime item', () => {
      expect(typeof response.anime).toBe('object');
      expect(response.anime.entry.length).toBeGreaterThan(0);
    });

  });

  describe('verifyCredentials()', () => {
    var failed;
    var response;

    beforeEach((done) => {
      mal = new MALjs(_ENV.user, _ENV.password);
      mal.verifyCredentials()
        .then(result => {
          failed = false;
          response = result;
          console.log('success:', result);
          done();
        })
        .catch(err => {
          failed = true;
          console.log('error:', err);
          done();
        });
    });

    it('should be able to retrieve user details', () => {
      expect(failed).toBe(false);
    });
  });

  describe('list()', () => {
    var failed;
    var response;

    beforeEach((done) => {
      mal = new MALjs(_ENV.user, _ENV.password);
      mal.list()
        .then(result => {
          failed = false;
          response = result;
          console.log('success:', result);
          done();
        })
        .catch(err => {
          failed = true;
          console.log('error:', err);
          done();
        });
    });

    it('should be able to retrieve user anime list', () => {
      expect(failed).toBe(false);
    });
  });

  describe('add()', () => {
    var failed;
    var response;

    beforeEach((done) => {
      mal = new MALjs(_ENV.user, _ENV.password);

      mal.add('71', {
        "episode": "1",
        "status": "6",
        "score": "7"
      })
      .then(results => {
        return mal.list();
      })
      .then(results => {
        console.log(results);
        failed = false;
        response = results;
        done();
      })
      .catch(err => {
        failed = true;
        console.log('error:', err);
        done();
      });
    });

    it('should be able to add an anime to the list', () => {
      expect(failed).toBe(false);
      expect(response.myanimelist).toBeDefined();
      expect(response.myanimelist.anime.series_animedb_id).toBe('71');
      expect(response.myanimelist.anime.my_status).toBe('6');
      expect(response.myanimelist.anime.my_watched_episodes).toBe('1');
    });
  });

  describe('update()', () => {
    var failed;
    var response;

    beforeEach((done) => {
      mal = new MALjs(_ENV.user, _ENV.password);

      mal.update('71', {
        "episode": "2",
        "status": "1",
        "score": "7"
      })
      .then(results => {
        return mal.list();
      })
      .then(results => {
        console.log(results);
        failed = false;
        response = results;
        done();
      })
      .catch(err => {
        failed = true;
        console.log('error:', err);
        done();
      });
    });

    it('should be able to update an anime to the list', () => {
      expect(failed).toBe(false);
      expect(response.myanimelist).toBeDefined();
      expect(response.myanimelist.anime.series_animedb_id).toBe('71');
      expect(response.myanimelist.anime.my_status).toBe('1');
      expect(response.myanimelist.anime.my_watched_episodes).toBe('2');
    });
  });

  describe('delete()', () => {
    var failed;
    var response;

    beforeEach((done) => {
      mal = new MALjs(_ENV.user, _ENV.password);

      mal.delete('71')
      .then(results => {
        return mal.list();
      })
      .then(results => {
        console.log(results);
        failed = false;
        response = results;
        done();
      })
      .catch(err => {
        failed = true;
        console.log('error:', err);
        done();
      });
    });

    it('should be able to delete an anime from the list', () => {
      expect(failed).toBe(false);
      expect(response.myanimelist.anime).not.toBeDefined();
    });
  });

});

{'fraction_non_alphanumeric': 0.1766287487073423, 'fraction_numerical': 0.0043433298862461224, 'mean_word_length': 1.9638369598528962, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 77, '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': '6768799', 'n_tokens_mistral': 3018, 'n_tokens_neox': 2918, 'n_words': 562}