/** * @fileOverview End-to-end testing of the get RTP list swagger API */ 'use strict'; const _ = require('lodash'); const helper = require('../../utils/test/e2e-helper'); let app; /** * * Test Values * */ // INCorrect auth method (Bearer), correct token const TOKEN_INVALID = 'ZTM2ZGQ1NzUtOWFmNS01MjMyLTg5MjYtM2NkZjA5ZDU2ZGU1'; const HEADER_INVALID = 'Bearer ' + TOKEN_INVALID; // Valid test data const correctParameters = { }; let badParameters; describe('E2E: get a list of RTP items', () => { /** * Load the dev API router to handle `/dev/*` routes */ before(() => { app = new helper.DevValidatorApp(); app.setRequestPath('/dev/v0/rtps'); }); // getAndValidate(expectedStatusCode, expectedErrors) // describe('test with an incorrect parameter', () => { /* * Tests where required top level attributes are missing. * ====================================================== */ it('added id parameter', () => { /* * No receiving account service key */ badParameters = _.cloneDeep(correctParameters); // badParameters.id = 0; return app.getAndValidate(badParameters, 400, [ helper.errors.missingRequired('receivingAccountServiceKey') ]); }); }); describe('authorization', () => { // eslint-disable-next-line mocha/no-hooks-for-single-case after(() => { // Reset the authorization header after these tests, whether they // pass or fail app.resetAuthorizationHeader(); }); it('is required to access the path', () => { app.setRequestAuthorization(HEADER_INVALID); return app.postAndValidate(correctParameters, 401); }); }); });