Skip to content

Commit 54617c2

Browse files
committed
added tests, rebuilt
1 parent dedf433 commit 54617c2

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

browser/swagger-client.js

Lines changed: 7 additions & 2 deletions
Large diffs are not rendered by default.

browser/swagger-client.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/client.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,6 +1405,23 @@ describe('SwaggerClient', function () {
14051405
});
14061406
});
14071407

1408+
it('should catch an error', function(done) {
1409+
new SwaggerClient({
1410+
url: 'http://localhost:8000/v2/issue-716.yaml',
1411+
usePromise: true
1412+
}).then(function(client) {
1413+
client.Data.getPets()
1414+
.then(function(data) {
1415+
done('shoulda failed');
1416+
})
1417+
.catch(function(err) {
1418+
done();
1419+
})
1420+
}).catch(function(exception) {
1421+
done(exception);
1422+
});
1423+
});
1424+
14081425
it('should read a blob', function(done) {
14091426
var spec = {
14101427
paths: {

test/request.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,12 @@ describe('swagger request functions', function () {
365365
expect(resp.headers['content-type']).toNotBe(undefined);
366366
expect(resp.headers['content-type']).toBe('text/plain');
367367

368+
done('should have failed');
369+
}, function(err) {
370+
expect(err.headers).toNotBe(undefined);
371+
expect(err.headers['content-type']).toNotBe(undefined);
372+
expect(err.headers['content-type']).toBe('text/plain');
373+
368374
done();
369375
});
370376
});

0 commit comments

Comments
 (0)