process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
var app = require("../../sample/express/app");
var request = require('supertest');

describe('POST tupas/ok', function(){
  it('to handle invalid post parameters', function(done){
    request(app)
      .post('/tupas/ok')
      .expect(400 , done);
  })
});




var request = require('supertest');
var express = require('express');

var app = express();

var globalOpts = {
  appHandler: app,
  hostUrl: "https://localhost:3000"
};

var tupas = require(__dirname + '/../../tupas').create(globalOpts);

tupas.on('success', function (req, res) {
  res.status(200).send('success');
});

tupas.on('mac-check-failed', function (req, res) {
  res.status(400).send('mac-check-failed');
});

describe('POST tupas/ok', function(){
  it('to handle invalid post parameters and trigger mac-check-failed', function(done){
    request(app)
      .post('/tupas/ok')
      .expect(400)
      .expect('mac-check-failed')
      .end(done);
  });
});

Remove sample app dependency from unit tests
Remove sample app dependency from unit tests

The point of the unit test for 'tupas/ok' route is to verify
that it will send an error event if verifying query parameters
fails (with empty POST payload). There's no need to use sample
app for this (it could well have its own set of tests), better
to verify this piece of core functionality with a self-contained
test setup.
