{"size": 1536, "ext": "js", "max_stars_repo_path": "src/mobile/components/location_search/test/location_search.test.js", "max_stars_repo_name": "zephraph/force", "max_stars_repo_stars_event_min_datetime": "2021-06-27T13:17:37.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-27T13:17:37.000Z", "max_issues_repo_path": "src/mobile/components/location_search/test/location_search.test.js", "max_issues_repo_name": "GinXian/force", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/mobile/components/location_search/test/location_search.test.js", "max_forks_repo_name": "GinXian/force", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.9272727273, "max_line_length": 90, "alphanum_fraction": 0.6080729167}
/*
 * decaffeinate suggestions:
 * DS102: Remove unnecessary code created because of implicit returns
 * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
 */
const Backbone = require("backbone")
const benv = require("benv")
const { resolve } = require("path")
const sinon = require("sinon")

describe("Location Search", function () {
  beforeEach(function (done) {
    return benv.setup(() => {
      benv.expose({
        $: benv.require("jquery"),
        google: {
          maps: {
            event: { addListener: sinon.stub() },
            places: { Autocomplete: sinon.stub() },
          },
        },
      })
      Backbone.$ = $
      benv.render(resolve(__dirname, "../template.jade"), () => {})
      ;({
        LocationSearchView: this.LocationSearchView,
      } = benv.requireWithJadeify(resolve(__dirname, "../index"), ["template"]))
      return done()
    })
  })

  afterEach(() => benv.teardown())

  beforeEach(function () {
    return (this.view = new this.LocationSearchView())
  })

  it("should render the template", function () {
    return this.view.render().$el.html().should.containEql("Enter your city")
  })

  it("attach a listener", function () {
    const spy = sinon.spy(this.view, "attach")
    this.view.render()
    return spy.called.should.be.ok()
  })

  return it("should announce it's location", function () {
    const spy = sinon.spy()
    this.view.on("location:update", spy)
    this.view.announce({})
    return spy.called.should.be.ok()
  })
})
