<commit_before>import { API } from 'api';
import superagent from 'superagent';

describe('api interface', () => {

  it('should export api version', () => {
    expect(API.version).toBe('0.0.1');
  });

  it('should get 0 captured requests', () => {
    expect(API.capturedRequests).toBeDefined();
    expect(API.capturedRequests.length).toBe(0);
  });

  it('should get a captured request', (done) => {
    expect(API.capturedRequests.length).toBe(0);

    superagent.get('http://fake.com')
      .timeout(20)
      .end(() => {<commit_msg>Clear storage before each test<commit_after>import { API } from 'api';
import superagent from 'superagent';

describe('api interface', () => {

  beforeEach(() => {
    API.clearStorage();
  });

  it('should export api version', () => {
    expect(API.version).toBe('0.0.1');
  });

  it('should get 0 captured requests', () => {
    expect(API.capturedRequests).toBeDefined();
    expect(API.capturedRequests.length).toBe(0);
  });

  it('should get a captured request', (done) => {
    expect(API.capturedRequests.length).toBe(0);

    superagent.get('http://fake.com')
      .timeout(20)
      .end(() => {
{'fraction_non_alphanumeric': 0.19548218940052128, 'fraction_numerical': 0.013900955690703735, 'mean_word_length': 3.682926829268293, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '772684', 'n_tokens_mistral': 383, 'n_tokens_neox': 367, 'n_words': 70}