forked from swagger-api/swagger-js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathswagger-api-listing-spec.js
62 lines (60 loc) · 1.84 KB
/
swagger-api-listing-spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Generated by CoffeeScript 1.6.3
(function() {
window.api_key = 'special-key';
describe('Swagger Api Listing for version 1.2 spec', function() {
beforeEach(function() {
var success;
success = function() {
return console.log("success");
};
window.authorizations.add("key", new ApiKeyAuthorization("api_key", "special-key", "header"));
window.swagger = new SwaggerApi({
url: 'http://petstore.swagger.wordnik.com/api/api-docs',
success: success
});
return waitsFor(function() {
return swagger.ready != null;
});
});
return describe("execute get operations", function() {
beforeEach(function() {
window.body = null;
window.response = null;
window.callback = null;
window.error = null;
window.success_callback = function(data) {
return window.response = data;
};
return window.error_callback = function(data) {
return window.error = data;
};
});
it("verifies the http request object for a GET", function() {
var opts, params;
params = {
headers: {},
petId: 1
};
opts = {
mock: true
};
window.response = swagger.apis;
return expect(swagger.apis.pet).toBeDefined;
});
return it("verifies the response messages from the get operation with query params", function() {
swagger.pet.findPetsByStatus({
status: "available"
}, window.success_callback);
waitsFor(function() {
return window.response != null;
});
return runs(function() {
var pet;
pet = JSON.parse(window.response.content.data);
console.log(pet);
return expect(pet.code).toNotBe(400);
});
});
});
});
}).call(this);