{"size": 1965, "ext": "js", "max_stars_repo_path": "src/views/admin/$index/components/PageTabs/__tests__/utils.spec.js", "max_stars_repo_name": "Aysnine/template-test", "max_stars_repo_stars_event_min_datetime": "2020-03-12T10:04:36.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-12T10:04:36.000Z", "max_issues_repo_path": "src/views/admin/$index/components/PageTabs/__tests__/utils.spec.js", "max_issues_repo_name": "Aysnine/template-test", "max_issues_repo_issues_event_min_datetime": "2021-03-10T10:48:00.000Z", "max_issues_repo_issues_event_max_datetime": "2021-03-10T10:48:00.000Z", "max_forks_repo_path": "src/views/admin/$index/components/PageTabs/__tests__/utils.spec.js", "max_forks_repo_name": "Aysnine/template-test", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 23.9634146341, "max_line_length": 77, "alphanum_fraction": 0.4305343511}
import { closeAll, closeOther, closeLeft, closeRight } from '../utils'

describe('closeAll', () => {
  it('should close all except fisrt, without switchTo', () => {
    expect(
      closeAll(
        [{ index: '/a' }, { index: '/b' }, { index: '/c' }, { index: '/d' }],
        '/a'
      )
    ).toEqual({
      tabs: [{ index: '/a' }],
      switchTo: undefined
    })
  })

  it('should close all except fisrt, with switchTo', () => {
    expect(
      closeAll(
        [{ index: '/a' }, { index: '/b' }, { index: '/c' }, { index: '/d' }],
        '/c'
      )
    ).toEqual({
      tabs: [{ index: '/a' }],
      switchTo: { index: '/a' }
    })
  })
})

describe('closeOther', () => {
  it('should close other except fisrt, without switchTo', () => {
    expect(
      closeOther(
        [{ index: '/a' }, { index: '/b' }, { index: '/c' }, { index: '/d' }],
        '/a'
      )
    ).toEqual({
      tabs: [{ index: '/a' }],
      switchTo: undefined
    })
  })

  it('should close other except fisrt, with switchTo', () => {
    expect(
      closeOther(
        [{ index: '/a' }, { index: '/b' }, { index: '/c' }, { index: '/d' }],
        '/c'
      )
    ).toEqual({
      tabs: [{ index: '/a' }, { index: '/c' }],
      switchTo: undefined
    })
  })
})

describe('closeLeft', () => {
  it('should close left except fisrt, without switchTo', () => {
    expect(
      closeLeft(
        [{ index: '/a' }, { index: '/b' }, { index: '/c' }, { index: '/d' }],
        '/c'
      )
    ).toEqual({
      tabs: [{ index: '/a' }, { index: '/c' }, { index: '/d' }],
      switchTo: undefined
    })
  })
})

describe('closeRight', () => {
  it('should close right except fisrt, without switchTo', () => {
    expect(
      closeRight(
        [{ index: '/a' }, { index: '/b' }, { index: '/c' }, { index: '/d' }],
        '/c'
      )
    ).toEqual({
      tabs: [{ index: '/a' }, { index: '/b' }, { index: '/c' }],
      switchTo: undefined
    })
  })
})
