Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ERROR DETAILS:
- ________________
- 5 passing (388ms)
- JESU 1000006679467
- (node:18036) UnhandledPromiseRejectionWarning: TypeError: '1000006679467' is not
- a thenable.
- at assertIsAboutPromise (C:\NodeJS\Kirubai\RestAPIMochaTest\test\node_module
- s\chai-as-promised\lib\chai-as-promised.js:31:19)
- at Assertion.<anonymous> (C:\NodeJS\Kirubai\RestAPIMochaTest\test\node_modul
- es\chai-as-promised\lib\chai-as-promised.js:53:13)
- at Assertion.propertyGetter (C:\NodeJS\Kirubai\RestAPIMochaTest\test\node_mo
- dules\chai\lib\chai\utils\addProperty.js:62:29)
- at Object.get (<anonymous>)
- at Object.proxyGetter [as get] (C:\NodeJS\Kirubai\RestAPIMochaTest\test\node
- _modules\chai\lib\chai\utils\proxify.js:98:22)
- at C:\NodeJS\Kirubai\RestAPIMochaTest\test\test.js:90:13
- at <anonymous>
- at process._tickCallback (internal/process/next_tick.js:189:7)
- (node:18036) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
- error originated either by throwing inside of an async function without a catch
- block, or by rejecting a promise which was not handled with .catch(). (rejectio
- n id: 4)
- JESU 1000006679467
- (node:18036) UnhandledPromiseRejectionWarning: AssertionError: expected [ Array(
- 4) ] to equal 'There is no account at the specified index'
- at getBasePromise.then.then.newArgs (C:\NodeJS\Kirubai\RestAPIMochaTest\test
- \node_modules\chai-as-promised\lib\chai-as-promised.js:302:22)
- at <anonymous>
- at process._tickCallback (internal/process/next_tick.js:189:7)
- (node:18036) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
- error originated either by throwing inside of an async function without a catch
- block, or by rejecting a promise which was not handled with .catch(). (rejectio
- n id: 5)
- ----------|----------|----------|----------|----------|-------------------|
- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
- ----------|----------|----------|----------|----------|-------------------|
- All files | 0 | 0 | 0 | 0 | |
- ----------|----------|----------|----------|----------|-------------------|
- Test.js
- ________
- var chai = require("chai");
- var chaiAsPromised = require("chai-as-promised");
- var expect = chai.expect;
- var assert = require('assert');
- var GetransfersController = require('../controllers/GetTransfers.js');
- chai.use(chaiAsPromised);
- /*Test Case 1 - Request is null
- describe('Request is null', function() {
- it('Request is null', function(){
- expect(
- GetransfersController.soap_call('','','','')
- ).to.eventually.equal('Get Transfer Request object is null');
- });
- });
- */
- // Test Case 1 - Request is null
- describe('Request is null', function() {
- it('Request is null', function(){
- expect(
- GetransfersController.soap_call('','','','')
- ).to.eventually.equal('Get Transfer Request object is null');
- });
- });
- // Test Case 2 - Account Number is not present
- describe('Account Number is not present', function() {
- it('Account Number is null', function(done){
- expect(
- GetransfersController.soap_call("null","772667527","4","4")
- ).to.eventually.equal('There is no account at the specified index');
- done();
- });
- });
- // Test Case 3 - Invalid transfer Transaction
- describe('Invalid transfer Transaction', function() {
- it('Invalid TransferType value', function(){
- expect(
- GetransfersController.soap_call('1000006679467','772667527','4','19')
- ).to.eventually.equal('Invalid TransferType value');
- });
- });
- // Test Case 4 - Invalid status Transaction
- describe('Invalid Status', function() {
- it('Invalid Status value', function(){
- expect(
- GetransfersController.soap_call('1000006679467','772667527','11','4')
- ).to.eventually.equal('The transfer status specified is invalid');
- });
- });
- // Test Case 5 - Right data
- describe('Right data', function() {
- it('Right data', function(){
- var testResultDebitNumber ="";
- GetransfersController.soap_call('1000006679467','772667527','4','4').then( function (result){
- // console.log('App returned data######');
- // console.log(typeof(result));
- let payments = result[0].response.paymentList.payment;
- payments.forEach((item, index) => {
- // Remove the line after testing
- //console.log(item.details.messageIdentifier + '\t' + item.instruction.debitAccountnumber + '\t' + item.instruction.creditAccountnumber);
- if(index ==0){
- testResultDebitNumber =item.instruction.debitAccountnumber;
- }
- });
- return expect(
- testResultDebitNumber
- ).to.eventually.equal('1000006679467');
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement