<commit_before>suite('Webhook', function () {

  var webhook;

  setup('Creating a new Webhook', function () {

    webhook = new Stamplay.Webhook('myWebHook');

    this.xhr = sinon.useFakeXMLHttpRequest();
    this.request;
    var _this = this;
    this.xhr.onCreate = function (xhr) {
      _this.request = xhr;
    };

  });

  //For each test
  teardown('Tearing down', function () {

    if (this.xhr) {
      this.xhr.restore();
    }

  });

  test('has the get method', function () {
    assert.isFunction(webhook.get, 'get method exists');
  });

  test('has the put method', function () {
    assert.isFunction(webhook.put, 'put method exists');
  });

  test('has the post method', function () {
    assert.isFunction(webhook.post, 'post method exists');
  });

  test('has the url property', function () {
    assert.isString(webhook.url, 'url string exists');
    assert.equal(webhook.url, '/api/webhook/v0/mywebhook/catch');
  });

  test('that the url is formatted correctly', function () {
    var w1 = new Stamplay.Webhook('Test_Test');
    assert.equal(w1.url, '/api/webhook/v0/test_test/catch');

    var w2 = new Stamplay.Webhook('a_b-c');
    assert.equal(w2.url, '/api/webhook/v0/a_bc/catch');

    // var w3 = new Stamplay.Webhook('?');
    // assert.equal(w1.url, '/api/webhook/v0/a_bc/catch');

  });


});<commit_msg>Testing get<commit_after>suite('Webhook', function () {

  var webhook;

  setup('Creating a new Webhook', function () {

    webhook = new Stamplay.Webhook('myWebHook');

    this.xhr = sinon.useFakeXMLHttpRequest();
    this.request;
    var _this = this;
    this.xhr.onCreate = function (xhr) {
      _this.request = xhr;
    };

  });

  //For each test
  teardown('Tearing down', function () {

    if (this.xhr) {
      this.xhr.restore();
    }

  });

  test('has the get method', function () {
    assert.isFunction(webhook.get, 'get method exists');
  });

  test('has the put method', function () {
    assert.isFunction(webhook.put, 'put method exists');
  });

  test('has the post method', function () {
    assert.isFunction(webhook.post, 'post method exists');
  });

  test('has the url property', function () {
    assert.isString(webhook.url, 'url string exists');
    assert.equal(webhook.url, '/api/webhook/v0/mywebhook/catch');
  });

  test('that the url is formatted correctly', function () {
    var w1 = new Stamplay.Webhook('Test_Test');
    assert.equal(w1.url, '/api/webhook/v0/test_test/catch');

    var w2 = new Stamplay.Webhook('a_b-c');
    assert.equal(w2.url, '/api/webhook/v0/a_bc/catch');
  });

  test('that get method will send a get request', function (done) {
    var response = {
      name: 'myWebHook',
      webhookId = 'mywebhook'
    }

    webhook.get().then(function (response) {
      console.log('response');
      console.log(response);
      done();
    });

    assert.equal(this.request.method, 'GET');
    assert.equal(this.request.requestHeaders['Content-Type'], "application/json;charset=utf-8");
    assert.equal(this.request.url, '/api/webhook/v0/mywebhook/catch');

    this.request.respond(200, {
      "Content-Type": "application/json"
    }, JSON.stringify(response));

  });


});
{'fraction_non_alphanumeric': 0.17193861572189165, 'fraction_numerical': 0.006890072032571249, 'mean_word_length': 3.1426718547341115, 'pattern_counts': {'":': 1, '<': 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': '5727448', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1078, 'n_words': 216}