Added unit tests setup
This commit is contained in:
7
dist/swagger-ui.js
vendored
7
dist/swagger-ui.js
vendored
File diff suppressed because one or more lines are too long
18
dist/swagger-ui.min.js
vendored
18
dist/swagger-ui.min.js
vendored
File diff suppressed because one or more lines are too long
29
karma.conf.js
Normal file
29
karma.conf.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = function(config) {
|
||||||
|
config.set({
|
||||||
|
frameworks: [ 'mocha', 'sinon-chai' ],
|
||||||
|
|
||||||
|
files: [
|
||||||
|
'dist/lib/jquery-1.8.0.min.js',
|
||||||
|
'dist/lib/jquery.slideto.min.js',
|
||||||
|
'dist/lib/jquery.wiggle.min.js',
|
||||||
|
'dist/lib/jquery.ba-bbq.min.js',
|
||||||
|
'dist/lib/handlebars-2.0.0.js',
|
||||||
|
'dist/lib/js-yaml.min.js',
|
||||||
|
'dist/lib/lodash.min.js',
|
||||||
|
'dist/lib/backbone-min.js',
|
||||||
|
'dist/swagger-ui.js',
|
||||||
|
'dist/lib/highlight.7.3.pack.js',
|
||||||
|
'dist/lib/jsoneditor.min.js',
|
||||||
|
'dist/lib/marked.js',
|
||||||
|
'dist/lib/swagger-oauth.js',
|
||||||
|
'test/unit/mock.js',
|
||||||
|
'test/unit/**/*.js'
|
||||||
|
],
|
||||||
|
|
||||||
|
reporters: [ 'dots' ],
|
||||||
|
|
||||||
|
browsers: [ 'PhantomJS', /* 'Chrome' */]
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -47,9 +47,17 @@
|
|||||||
"gulp-wrap": "^0.11.0",
|
"gulp-wrap": "^0.11.0",
|
||||||
"http-server": "^0.8.0",
|
"http-server": "^0.8.0",
|
||||||
"jshint-stylish": "^1.0.1",
|
"jshint-stylish": "^1.0.1",
|
||||||
|
"karma": "0.13.19",
|
||||||
|
"karma-chai": "0.1.0",
|
||||||
|
"karma-chrome-launcher": "0.2.2",
|
||||||
|
"karma-mocha": "0.2.1",
|
||||||
|
"karma-phantomjs-launcher": "0.2.3",
|
||||||
|
"karma-sinon-chai": "1.1.0",
|
||||||
"less": "^2.4.0",
|
"less": "^2.4.0",
|
||||||
"mocha": "^2.1.0",
|
"mocha": "^2.1.0",
|
||||||
|
"phantomjs": "1.9.19",
|
||||||
"selenium-webdriver": "^2.45.0",
|
"selenium-webdriver": "^2.45.0",
|
||||||
|
"sinon-chai": "2.8.0",
|
||||||
"swagger-client": "2.1.9"
|
"swagger-client": "2.1.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
--recursive --timeout 5000
|
test/e2e/**/*.js --recursive --timeout 5000
|
||||||
|
|||||||
56
test/unit/mock.js
Normal file
56
test/unit/mock.js
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
$(function () {
|
||||||
|
'use strict';
|
||||||
|
var url = window.location.search.match(/url=([^&]+)/);
|
||||||
|
if (url && url.length > 1) {
|
||||||
|
url = decodeURIComponent(url[1]);
|
||||||
|
} else {
|
||||||
|
url = 'http://petstore.swagger.io/v2/swagger.json';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pre load translate...
|
||||||
|
if(window.SwaggerTranslator) {
|
||||||
|
window.SwaggerTranslator.translate();
|
||||||
|
}
|
||||||
|
window.swaggerUi = new SwaggerUi({
|
||||||
|
url: url,
|
||||||
|
dom_id: 'swagger-ui-container',
|
||||||
|
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
|
||||||
|
onComplete: function(){
|
||||||
|
if(typeof initOAuth === 'function') {
|
||||||
|
initOAuth({
|
||||||
|
clientId: 'your-client-id',
|
||||||
|
clientSecret: 'your-client-secret-if-required',
|
||||||
|
realm: 'your-realms',
|
||||||
|
appName: 'your-app-name',
|
||||||
|
scopeSeparator: ',',
|
||||||
|
additionalQueryStringParams: {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(window.SwaggerTranslator) {
|
||||||
|
window.SwaggerTranslator.translate();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('pre code').each(function(i, e) {
|
||||||
|
hljs.highlightBlock(e);
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
onFailure: function() {
|
||||||
|
log('Unable to Load SwaggerUI');
|
||||||
|
},
|
||||||
|
docExpansion: 'none',
|
||||||
|
jsonEditor: false,
|
||||||
|
apisSorter: 'alpha',
|
||||||
|
defaultModelRendering: 'schema',
|
||||||
|
showRequestHeaders: false
|
||||||
|
});
|
||||||
|
|
||||||
|
window.swaggerUi.load();
|
||||||
|
|
||||||
|
function log() {
|
||||||
|
if ('console' in window) {
|
||||||
|
console.log.apply(console, arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
9
test/unit/test.js
Normal file
9
test/unit/test.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
// var expect = require('chai').expect;
|
||||||
|
|
||||||
|
describe('', function () {
|
||||||
|
it('', function () {
|
||||||
|
expect(true).to.equal(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user