<commit_before>import Whoami from './whoami'
import * as nock from 'nock'

let mockMachines: any

jest.mock(
  'netrc-parser',
  () =>
    class {
      machines = mockMachines
    },
)

let api: nock.Scope

beforeEach(() => {
  api = nock('https://api.heroku.com')
})

afterEach(() => {
  api.done()
})

describe('not logged in', () => {
  beforeEach(() => {
    mockMachines = {
      'api.heroku.com': {},
    }
  })

  it('errors', async () => {
    expect.assertions(1)
    try {
      await Whoami.mock()
    } catch (err) {
      expect(err.code).toEqual(100)
    }
  })
})

describe('logged in', () => {
  beforeEach(() => {<commit_msg>remove HEROKU_API_KEY<commit_after>import Whoami from './whoami'
import * as nock from 'nock'

let mockMachines: any

jest.mock(
  'netrc-parser',
  () =>
    class {
      machines = mockMachines
    },
)

let api: nock.Scope

beforeEach(() => {
  delete process.env.HEROKU_API_KEY
  api = nock('https://api.heroku.com')
})

afterEach(() => {
  api.done()
})

describe('not logged in', () => {
  beforeEach(() => {
    mockMachines = {
      'api.heroku.com': {},
    }
  })

  it('errors', async () => {
    expect.assertions(1)
    try {
      await Whoami.mock()
    } catch (err) {
      expect(err.code).toEqual(100)
    }
  })
})

describe('logged in', () => {
  beforeEach(() => {
{'fraction_non_alphanumeric': 0.1981981981981982, 'fraction_numerical': 0.006006006006006006, 'mean_word_length': 2.662087912087912, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 2, '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': '3930421', 'n_tokens_mistral': 515, 'n_tokens_neox': 501, 'n_words': 89}