import * as React from "react"
import SocialPanel, { createNewURLFromPathname } from "../SocialPanel"
import { create } from "react-test-renderer"
import { SocialMediaShareContentType } from "jamplay-common/client/share"
describe("SocialPanel test", () => {
  it("should crate url correctly", () => {
    // tslint:disable-next-line:no-string-literal
    create(
      <SocialPanel
        contentId="123"
        contentType={SocialMediaShareContentType.AUTHOR}
      />
    )
    if (typeof window !== "undefined") {
      const url = createNewURLFromPathname("/b/c")
      expect(url).toEqual("https://www.jamplay.world/b/c")
    }
  })

  it("should match snapshot", () => {
    const t = create(<SocialPanel contentId="123" contentType={SocialMediaShareContentType.AUTHOR} />)

    expect(t.toJSON()).toMatchSnapshot()

  })
})
