<commit_before>var tape = require("tape")
  , jsonp = require("../")

tape("jsonp._resolveUrl", function(test){

  test.equal(jsonp._resolveUrl("foo", "bar=baz"), "foo?bar=baz")
  test.equal(jsonp._resolveUrl("foo?", "bar=baz"), "foo?bar=baz")
  test.equal(jsonp._resolveUrl("foo?foo=bar", "bar=baz"), "foo?foo=bar&bar=baz")
  test.end()

})

tape("jsonp", function(test){
  
  test.plan(3)
  
  var fetcher = jsonp.create("http://api.openweathermap.org/data/2.5/weather?q=London,uk")
    , firstName
  
  fetcher
    .load()
    .then(function(object){
      test.equal(object.sys.country, "GB", "received object")
      test.equal(window["bloodyjsonp0"], null, "removed callback from global object")
    })
    .then(function(){
      return fetcher.load()
    })
    .then(function(object){
      test.equal(window["bloodyjsonp1"], null, "updates fetcher name")
    })
  
})

tape("jsonp failure", function(test){

  test.plan(2)
  var fetcher = jsonp.create("foo/bar")

  fetcher
    .load()
    .then(function(){
      test.fail("shouln't execute successCallback")
    }, function(err){
      test.pass("should execute successCallback")
      test.ok(Error.prototype.isPrototypeOf(err), "gets error")
    })

})<commit_msg>updated tests to get error status<commit_after>var tape = require("tape")
  , jsonp = require("../")

tape("jsonp._resolveUrl", function(test){

  test.equal(jsonp._resolveUrl("foo", "bar=baz"), "foo?bar=baz")
  test.equal(jsonp._resolveUrl("foo?", "bar=baz"), "foo?bar=baz")
  test.equal(jsonp._resolveUrl("foo?foo=bar", "bar=baz"), "foo?foo=bar&bar=baz")
  test.end()

})

tape("jsonp", function(test){
  
  test.plan(3)
  
  var fetcher = jsonp.create("http://api.openweathermap.org/data/2.5/weather?q=London,uk")
    , firstName
  
  fetcher
    .load()
    .then(function(object){
      test.equal(object.sys.country, "GB", "received object")
      test.equal(window["bloodyjsonp0"], null, "removed callback from global object")
    })
    .then(function(){
      return fetcher.load()
    })
    .then(function(object){
      test.equal(window["bloodyjsonp1"], null, "updates fetcher name")
    })
  
})

tape("jsonp failure", function(test){

  test.plan(2)
  var fetcher = jsonp.create("http://api.openweathermap.org/data/2.5/foo?q=London,uk")

  fetcher
    .load()
    .then(function(){
      test.fail("shouln't execute successCallback")
    }, function(err){
      test.pass("should execute successCallback")
      test.ok(Error.prototype.isPrototypeOf(err), "gets error")
    })

})
{'fraction_non_alphanumeric': 0.18826793499801822, 'fraction_numerical': 0.005548949663099485, 'mean_word_length': 3.863198458574181, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7169044', 'n_tokens_mistral': 922, 'n_tokens_neox': 893, 'n_words': 139}