Skip to content

Commit

Permalink
Add test case for operations returning promise
Browse files Browse the repository at this point in the history
  • Loading branch information
shimks committed May 8, 2018
1 parent c950610 commit b691f7e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,22 @@ describe('soap connector', function () {
});
});

it('should support model methods as promises', function (done) {
var StockQuoteService = ds.createModel('StockQuoteService', {});

// Short method names
StockQuoteService.GetQuote({symbol: 'IBM'}).then(function (response) {
var index = response.GetQuoteResult.indexOf('<StockQuotes><Stock><Symbol>IBM</Symbol><Last>');
//StockQoute external webservice sends 'exception' rarely as a response. This is not a problem with connector code. This happens even when we use
//web service client provided by them, http://www.webservicex.net/New/Home/ServiceDetail/9 Hence below check accounts for this.
if (index === -1) {
index = response.GetQuoteResult.indexOf('exception');
}
assert.ok(index > -1);
done();
}, done);
});

});

describe('XML/JSON conversion utilities', function() {
Expand Down

0 comments on commit b691f7e

Please sign in to comment.