import Server from '../../src' import { merge } from 'ramda' const options = { method: 'POST', payload: { live: false, notification: { additional_data: { auth_code: '12449', card_summary: '1111', expiry_date: '08/2018' }, amount: { currency: 'EUR', value: 8800 }, event_code: 'AUTHORISATION', event_date: '2016-04-28T17:10:52+02:00', is_3d: false, operations: [ 'CANCEL', 'CAPTURE', 'REFUND' ], order_id: 'order99-12778', payment_id: '5ce71940-04cf-11e7-b34e-73c21302c677', success: true } }, url: '/notifications' } describe('`POST /notifications`', () => { it('should accept a valid notification', done => { Server.inject(options, res => { expect(res.statusCode).toBe(200) expect(res.result).toEqual('OK') done() }) }) it('should return a 400 if payload is invalid', done => { Server.inject(merge(options, { payload: {} }), res => { expect(res.statusCode).toBe(400) expect(res.result).not.toEqual('OK') done() }) }) })