<commit_before>import React from "react"
import { mount } from "enzyme"
import { AuthWrapper } from "../AuthWrapper"
import { data as sd } from "sharify"

jest.mock("sharify")
jest.mock("querystring", () => ({
  parse: jest.fn().mockReturnValue({}),
}))
jest.mock("desktop/components/cookies/index.coffee", () => ({
  get: jest.fn(),
  set: jest.fn(),
}))
jest.mock("desktop/lib/mediator.coffee", () => ({
  trigger: jest.fn(),
  on: jest.fn(),
}))
const mediatorTrigger = require("desktop/lib/mediator.coffee")
  .trigger as jest.Mock
const mediatorOn = require("desktop/lib/mediator.coffee").on as jest.Mock
const qsMock = require("querystring").parse as jest.Mock
const CookiesGetMock = require("desktop/components/cookies/index.coffee")
  .get as jest.Mock
const CookiesSetMock = require("desktop/components/cookies/index.coffee")
  .set as jest.Mock

jest.useFakeTimers()

describe("AuthWrapper", () => {
  beforeEach(() => {
    delete sd.IS_MOBILE
    delete sd.CURRENT_USER
  })

  const getWrapper = () => {
    return mount(<AuthWrapper />)
  }

  describe("#componentWillMount", () => {
    it("does nothing if IS_MOBILE", () => {
      sd.IS_MOBILE = true
      const component = getWrapper().instance() as AuthWrapper
      expect(component.openModal).toBe(undefined)
      expect(mediatorOn).not.toBeCalled()
    })

    it("does nothing if CURRENT_USER", () => {
      sd.CURRENT_USER = { name: "Carter" }
      const component = getWrapper().instance() as AuthWrapper
      expect(component.openModal).toBe(undefined)
      expect(mediatorOn).not.toBeCalled()
    })

    it("does nothing if user has dismiss cookie", () => {<commit_msg>clear sharify mock<commit_after>import React from "react"
import { mount } from "enzyme"
import { AuthWrapper } from "../AuthWrapper"
import sharify, { data as sd } from "sharify"

jest.mock("sharify")
jest.mock("querystring", () => ({
  parse: jest.fn().mockReturnValue({}),
}))
jest.mock("desktop/components/cookies/index.coffee", () => ({
  get: jest.fn(),
  set: jest.fn(),
}))
jest.mock("desktop/lib/mediator.coffee", () => ({
  trigger: jest.fn(),
  on: jest.fn(),
}))
const mediatorTrigger = require("desktop/lib/mediator.coffee")
  .trigger as jest.Mock
const mediatorOn = require("desktop/lib/mediator.coffee").on as jest.Mock
const qsMock = require("querystring").parse as jest.Mock
const CookiesGetMock = require("desktop/components/cookies/index.coffee")
  .get as jest.Mock
const CookiesSetMock = require("desktop/components/cookies/index.coffee")
  .set as jest.Mock

jest.useFakeTimers()

describe("AuthWrapper", () => {
  beforeEach(() => {
    delete sd.IS_MOBILE
    delete sd.CURRENT_USER
  })

  afterEach(() => {
    sharify.mockClear()
  })

  const getWrapper = () => {
    return mount(<AuthWrapper />)
  }

  describe("#componentWillMount", () => {
    it("does nothing if IS_MOBILE", () => {
      sd.IS_MOBILE = true
      const component = getWrapper().instance() as AuthWrapper
      expect(component.openModal).toBe(undefined)
      expect(mediatorOn).not.toBeCalled()
    })

    it("does nothing if CURRENT_USER", () => {
      sd.CURRENT_USER = { name: "Carter" }
      const component = getWrapper().instance() as AuthWrapper
      expect(component.openModal).toBe(undefined)
      expect(mediatorOn).not.toBeCalled()
    })

    it("does nothing if user has dismiss cookie", () => {
{'fraction_non_alphanumeric': 0.1655786350148368, 'fraction_numerical': 0.0, 'mean_word_length': 3.921167883211679, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, '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': '3956826', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1053, 'n_words': 217}