<commit_before>var should = require('should');
var expect = require('chai').expect;
var request = require('supertest');

var app = require('./../server')
 
describe('Server Endpoints', function(){
  request = request('http://localhost:9000');
  var events = '/api/events';
  describe('Event API', function(){
    it('GET "api/events/" should send non empty response', function(done) {
      request.get(events)
        .expect(200)
        .end(function (err, res) {
          if (err) done(err);
          done();
        });
    });

    it('GET api/events/:id should send the event with requested id', function(done) {
      request.get(events + '/1')
        .expect(200)
        .end(function (err, res) {
          if (err) done(err);
          var event = res.body;
          expect(event.id).to.equal(1)
          expect(event.title).to.equal('SantaCon')
          done()
        })
    });

    it('should have a responsive POST api/events/  ', function(done) {
      done()
    });
  });<commit_msg>tests basic post unauth response<commit_after>var should = require('should');
var expect = require('chai').expect;
var request = require('supertest');

// run the app for testing and import access
var app = require('./../server');
 
describe('Server Endpoints', function(){
  request = request('http://localhost:9000');
  var events = '/api/events';
  describe('Event API', function(){
    it('GET "api/events/" should send non empty response', function(done) {
      request.get(events)
        .expect(200)
        .end(function (err, res) {
          if (err) done(err);
          done();
        });
    });

    it('GET api/events/:id should send the event with requested id', function(done) {
      request.get(events + '/1')
        .expect(200)
        .end(function (err, res) {
          if (err) done(err);
          var event = res.body;
          expect(event.id).to.equal(1)
          expect(event.title).to.equal('SantaCon')
          done()
        })
    });

    it('should redirect POST "api/events/" to "/" if not logged in', function(done) {
      request.post(events)
        .expect(302)
        .end(function (err, res) {
          if (err) done(err);
          else done();
        })
    });
  });
{'fraction_non_alphanumeric': 0.16756272401433692, 'fraction_numerical': 0.012096774193548387, 'mean_word_length': 2.3378176382660687, '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': '465931', 'n_tokens_mistral': 681, 'n_tokens_neox': 655, 'n_words': 170}