cc-tracking/tasks/archive/comcarde/bridge-860/get-all-atps-for-rtp.spec.js
2019-05-21 16:40:16 +01:00

47 lines
1.4 KiB
JavaScript

/**
* @fileOverview End-to-end testing of the get all ATPs related to a payable RTP
*/
'use strict';
const helper = require('../../utils/test/e2e-helper');
let app;
// Standard errored values
const TOO_LONG = '0000000000000000000000001';
const TOO_SHORT = '0123';
const BAD_UUID = '00000000000000000000000Z';
const VALID_UUID = '000000000000000000000000';
// Valid test data
describe('E2E: get All ATPs', () => {
/**
* Load the dev API router to handle `/dev/*` routes
*/
before(() => {
app = new helper.DevValidatorApp();
});
it('with a valid objectID', () => {
app.setRequestPath('/dev/v0/payables/rtps/' + VALID_UUID + '/atps');
return app.getAndValidate(502);
});
it('objectID with an invalid pattern', () => {
app.setRequestPath('/dev/v0/payables/rtps/' + BAD_UUID + '/atps');
return app.getAndValidate(400, undefined, helper.errors.failedPattern('objectID'));
});
it('objectID is too short', () => {
app.setRequestPath('/dev/v0/payables/rtps/' + TOO_SHORT + '/atps');
return app.getAndValidate(400, undefined, helper.errors.minLength('objectID'));
});
it('objectID is too long', () => {
app.setRequestPath('/dev/v0/payables/rtps/' + TOO_LONG + '/atps');
return app.getAndValidate(400, undefined, helper.errors.maxLength('objectID'));
});
});