<commit_before>import test from 'tape'
import { shallow } from 'enzyme'
import React from 'react'

import Breadcrumbs from './breadcrumbs'

test('<Breadcrumbs /> with no props should throw error', t => {
  t.throws(() => {
    shallow(<Breadcrumbs />)
  })
  t.end()
})
test('<Breadcrumbs /> with no `splat` (path) should render a Link to repo', t => {
  const props = {
    params: { owner: 'foo', repo: 'bar' }
  }
  const wrapper = shallow(<Breadcrumbs {...props} />)
  t.is(wrapper.find('Link').length, 1)
  t.end()
})
test('<Breadcrumbs /> with 3rd level `splat` (path) should render three Links each dir', t => {
  const props = {
    params: { owner: 'foo', repo: 'bar', splat: 'a/b/c' }
  }
  const wrapper = shallow(<Breadcrumbs {...props} />)
  t.is(wrapper.find('Link').length, 3)
  t.is(
    wrapper
      .find('Link')
      .at(0)
      .props().to,
    '/foo/bar/tree/master'
  )
  t.is(
    wrapper
      .find('Link')
      .at(1)
      .props().to,
    '/foo/bar/tree/master/a'
  )
  t.is(
    wrapper
      .find('Link')
      .at(2)
      .props().to,
    '/foo/bar/tree/master/a/b'
  )
  t.end()
})<commit_msg>Pass typecheck<commit_after>// @flow

import test from 'tape'
import { shallow } from 'enzyme'
import React from 'react'

import Breadcrumbs from './breadcrumbs'

test('<Breadcrumbs /> with no `splat` (path) should render a Link to repo', t => {
  const props = {
    params: { owner: 'foo', repo: 'bar', tree: 'TREE', splat: 'SPLAT' }
  }
  const wrapper = shallow(<Breadcrumbs {...props} />)
  t.is(wrapper.find('Link').length, 1)
  t.end()
})
test('<Breadcrumbs /> with 3rd level `splat` (path) should render three Links each dir', t => {
  const props = {
    params: { owner: 'foo', repo: 'bar', tree: 'TREE', splat: 'a/b/c' }
  }
  const wrapper = shallow(<Breadcrumbs {...props} />)
  t.is(wrapper.find('Link').length, 3)
  t.is(
    wrapper
      .find('Link')
      .at(0)
      .props().to,
    '/foo/bar/tree/TREE'
  )
  t.is(
    wrapper
      .find('Link')
      .at(1)
      .props().to,
    '/foo/bar/tree/TREE/a'
  )
  t.is(
    wrapper
      .find('Link')
      .at(2)
      .props().to,
    '/foo/bar/tree/TREE/a/b'
  )
  t.end()
})
{'fraction_non_alphanumeric': 0.19990829894543788, 'fraction_numerical': 0.005502063273727648, 'mean_word_length': 2.5193548387096776, 'pattern_counts': {'":': 0, '<': 13, '<?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': '4439670', 'n_tokens_mistral': 850, 'n_tokens_neox': 852, 'n_words': 198}