Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.74 KB | None | 0 0
  1.  
  2.  
  3. ERROR DETAILS:
  4. ________________
  5. 5 passing (388ms)
  6.  
  7. JESU 1000006679467
  8. (node:18036) UnhandledPromiseRejectionWarning: TypeError: '1000006679467' is not
  9. a thenable.
  10. at assertIsAboutPromise (C:\NodeJS\Kirubai\RestAPIMochaTest\test\node_module
  11. s\chai-as-promised\lib\chai-as-promised.js:31:19)
  12. at Assertion.<anonymous> (C:\NodeJS\Kirubai\RestAPIMochaTest\test\node_modul
  13. es\chai-as-promised\lib\chai-as-promised.js:53:13)
  14. at Assertion.propertyGetter (C:\NodeJS\Kirubai\RestAPIMochaTest\test\node_mo
  15. dules\chai\lib\chai\utils\addProperty.js:62:29)
  16. at Object.get (<anonymous>)
  17. at Object.proxyGetter [as get] (C:\NodeJS\Kirubai\RestAPIMochaTest\test\node
  18. _modules\chai\lib\chai\utils\proxify.js:98:22)
  19. at C:\NodeJS\Kirubai\RestAPIMochaTest\test\test.js:90:13
  20. at <anonymous>
  21. at process._tickCallback (internal/process/next_tick.js:189:7)
  22. (node:18036) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
  23. error originated either by throwing inside of an async function without a catch
  24. block, or by rejecting a promise which was not handled with .catch(). (rejectio
  25. n id: 4)
  26. JESU 1000006679467
  27. (node:18036) UnhandledPromiseRejectionWarning: AssertionError: expected [ Array(
  28. 4) ] to equal 'There is no account at the specified index'
  29. at getBasePromise.then.then.newArgs (C:\NodeJS\Kirubai\RestAPIMochaTest\test
  30. \node_modules\chai-as-promised\lib\chai-as-promised.js:302:22)
  31. at <anonymous>
  32. at process._tickCallback (internal/process/next_tick.js:189:7)
  33. (node:18036) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
  34. error originated either by throwing inside of an async function without a catch
  35. block, or by rejecting a promise which was not handled with .catch(). (rejectio
  36. n id: 5)
  37. ----------|----------|----------|----------|----------|-------------------|
  38. File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
  39. ----------|----------|----------|----------|----------|-------------------|
  40. All files | 0 | 0 | 0 | 0 | |
  41. ----------|----------|----------|----------|----------|-------------------|
  42.  
  43.  
  44.  
  45. Test.js
  46. ________
  47.  
  48. var chai = require("chai");
  49. var chaiAsPromised = require("chai-as-promised");
  50. var expect = chai.expect;
  51. var assert = require('assert');
  52. var GetransfersController = require('../controllers/GetTransfers.js');
  53. chai.use(chaiAsPromised);
  54.  
  55. /*Test Case 1 - Request is null
  56. describe('Request is null', function() {
  57. it('Request is null', function(){
  58.  
  59. expect(
  60. GetransfersController.soap_call('','','','')
  61. ).to.eventually.equal('Get Transfer Request object is null');
  62. });
  63.  
  64. });
  65. */
  66.  
  67.  
  68. // Test Case 1 - Request is null
  69. describe('Request is null', function() {
  70. it('Request is null', function(){
  71.  
  72. expect(
  73. GetransfersController.soap_call('','','','')
  74. ).to.eventually.equal('Get Transfer Request object is null');
  75. });
  76.  
  77. });
  78.  
  79. // Test Case 2 - Account Number is not present
  80. describe('Account Number is not present', function() {
  81. it('Account Number is null', function(done){
  82.  
  83. expect(
  84. GetransfersController.soap_call("null","772667527","4","4")
  85. ).to.eventually.equal('There is no account at the specified index');
  86. done();
  87. });
  88.  
  89. });
  90.  
  91. // Test Case 3 - Invalid transfer Transaction
  92. describe('Invalid transfer Transaction', function() {
  93. it('Invalid TransferType value', function(){
  94.  
  95. expect(
  96. GetransfersController.soap_call('1000006679467','772667527','4','19')
  97. ).to.eventually.equal('Invalid TransferType value');
  98. });
  99.  
  100. });
  101.  
  102. // Test Case 4 - Invalid status Transaction
  103. describe('Invalid Status', function() {
  104. it('Invalid Status value', function(){
  105. expect(
  106. GetransfersController.soap_call('1000006679467','772667527','11','4')
  107. ).to.eventually.equal('The transfer status specified is invalid');
  108. });
  109.  
  110. });
  111.  
  112.  
  113. // Test Case 5 - Right data
  114. describe('Right data', function() {
  115. it('Right data', function(){
  116.  
  117. var testResultDebitNumber ="";
  118.  
  119. GetransfersController.soap_call('1000006679467','772667527','4','4').then( function (result){
  120. // console.log('App returned data######');
  121. // console.log(typeof(result));
  122. let payments = result[0].response.paymentList.payment;
  123. payments.forEach((item, index) => {
  124. // Remove the line after testing
  125. //console.log(item.details.messageIdentifier + '\t' + item.instruction.debitAccountnumber + '\t' + item.instruction.creditAccountnumber);
  126. if(index ==0){
  127. testResultDebitNumber =item.instruction.debitAccountnumber;
  128. }
  129. });
  130.  
  131. return expect(
  132. testResultDebitNumber
  133. ).to.eventually.equal('1000006679467');
  134. });
  135.  
  136. });
  137.  
  138.  
  139. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement