import { SearchMeta } from "v2/Apps/Search/Components/SearchMeta"
import { MockBoot } from "v2/DevTools"
import { mount } from "enzyme"
import React from "react"
import { Link, Title } from "react-head"

jest.mock("sharify", () => ({
  data: {
    APP_URL: "test-url",
  },
}))
describe("Meta tags", () => {
  const getWrapper = () => {
    return mount(
      <MockBoot>
        <SearchMeta term="cats" />
      </MockBoot>
    )
  }

    const title = component.find(Title)
    expect(title.at(0).text()).toContain("Search Results for 'cats' | Artsy")
  })

  it("includes the proper url", () => {
    const component = getWrapper()
    const link = component.find(Link).at(0).html()

    expect(link).toEqual(
      '<link rel="canonical" href="test-url/search?term=cats">'
    )
  })
})
  it("includes the proper title", () => {
    const component = getWrapper()