<commit_before>import { ContextProvider } from "Artsy"
import { MockBoot } from "DevTools"
import { mount } from "enzyme"
import React from "react"
import { SearchApp } from "../SearchApp"

jest.mock("found", () => {
  return {
    Link: ({
      to,
      children: {
        props: { children },
      },
    }) => {
      return `<a href=${to}>${children}</a>`
    },
  }
})

describe("SearchApp", () => {
  const getWrapper = (searchProps: any) => {
    return mount(
      <MockBoot>
        <ContextProvider>
          <SearchApp {...searchProps} />
        </ContextProvider>
      </MockBoot>
    )
  }

  const props = {
    location: {
      query: { term: "andy" },
    },
    viewer: {
      search: {
        aggregations: [
          {
            slice: "TYPE",
            counts: [
              { name: "PartnerGallery", count: 100 },
              { name: "artist", count: 320 },
            ],
          },
        ],
      },
      filter_artworks: {
        counts: {
          total: 100,
        },
      },
    },
  }

  it("includes the total count", () => {
    const wrapper = getWrapper(props) as any
    const html = wrapper.html()
    expect(html).toContain('520 Results for "andy"')
  })

  it("includes tabs w/ counts", () => {
    const wrapper = getWrapper(props) as any
    const html = wrapper.html()
    expect(html).toContain("Artworks 100")
    expect(html).toContain("Artists 320")
    expect(html).toContain("Galleries 100")
  })
})<commit_msg>[Search] Update mock for tabs<commit_after>import { ContextProvider } from "Artsy"
import { MockBoot } from "DevTools"
import { mount } from "enzyme"
import React from "react"
import { SearchApp } from "../SearchApp"

jest.mock("Components/v2/RouteTabs", () => ({
  RouteTab: ({ children }) => children,
  RouteTabs: ({ children }) => children,
}))

describe("SearchApp", () => {
  const getWrapper = (searchProps: any) => {
    return mount(
      <MockBoot>
        <ContextProvider>
          <SearchApp {...searchProps} />
        </ContextProvider>
      </MockBoot>
    )
  }

  const props = {
    location: {
      query: { term: "andy" },
    },
    viewer: {
      search: {
        aggregations: [
          {
            slice: "TYPE",
            counts: [
              { name: "PartnerGallery", count: 100 },
              { name: "artist", count: 320 },
            ],
          },
        ],
      },
      filter_artworks: {
        counts: {
          total: 100,
        },
      },
    },
  }

  it("includes the total count", () => {
    const wrapper = getWrapper(props) as any
    const html = wrapper.html()
    expect(html).toContain('520 Results for "andy"')
  })

  it("includes tabs w/ counts", () => {
    const wrapper = getWrapper(props) as any
    const html = wrapper.html()
    expect(html).toMatch(/Artworks.*100/)
    expect(html).toMatch(/Artists.*320/)
    expect(html).toMatch(/Galleries.*100/)
  })
})
{'fraction_non_alphanumeric': 0.16154371584699453, 'fraction_numerical': 0.014685792349726777, 'mean_word_length': 2.0071868583162216, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 28, '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': '5619147', 'n_tokens_mistral': 950, 'n_tokens_neox': 895, 'n_words': 200}