-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tags property parsing refactoring (#36)
- Loading branch information
1 parent
c809ffc
commit 564ec42
Showing
5 changed files
with
90 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,5 +29,6 @@ node_modules | |
# JSDoc | ||
jsdoc | ||
|
||
# Cloud9 editor | ||
# Editors | ||
.c9 | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,62 +8,53 @@ var swaggerSpec = require('./swagger-spec.json'); | |
|
||
|
||
// Check against saved swagger spec | ||
function equalsToBeSwaggerSpec(res) { | ||
|
||
function swaggerSpecIsCompliant(res) { | ||
// Check if result equals expected spec | ||
if (JSON.stringify(res.body) !== JSON.stringify(swaggerSpec)) { | ||
throw new Error('Returned spec does not equal the expected result'); | ||
} | ||
|
||
} | ||
|
||
|
||
describe('example app', function() { | ||
|
||
it('homepage', function(done) { | ||
// Testing an example app parsing documentation with swagger-jsdoc. | ||
describe('example app', function () { | ||
it('homepage returns a success code', function (done) { | ||
request(app) | ||
.get('/') | ||
.expect(200) | ||
.end(function(err) { | ||
.end(function (err) { | ||
if (err) { | ||
return done(err); | ||
} | ||
done(); | ||
}); | ||
}); | ||
|
||
it('login', function(done) { | ||
it('login authentication returns a success code', function (done) { | ||
request(app) | ||
.post('/login') | ||
.send({ | ||
username: '[email protected]', | ||
password: 'Password', | ||
}) | ||
.expect(200) | ||
.end(function(err) { | ||
.end(function (err) { | ||
if (err) { | ||
return done(err); | ||
} | ||
done(); | ||
}); | ||
}); | ||
|
||
}); | ||
|
||
|
||
describe('swagger spec', function() { | ||
|
||
it('equals expected result', function(done) { | ||
it('produced swagger spec is as expected', function (done) { | ||
request(app) | ||
.get('/api-docs.json') | ||
.expect(200) | ||
.expect(equalsToBeSwaggerSpec) | ||
.end(function(err) { | ||
.expect(swaggerSpecIsCompliant) | ||
.end(function (err) { | ||
if (err) { | ||
return done(err); | ||
} | ||
done(); | ||
}); | ||
}); | ||
|
||
}); |