mirror of
https://github.com/ansible/awx.git
synced 2026-02-20 20:50:06 -03:30
Reorganize test directory structure
This commit is contained in:
@@ -55,7 +55,11 @@ var define, requireModule, require, requirejs;
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!registry[name]) {
|
if (!registry[name]) {
|
||||||
throw new Error('Could not find module ' + name);
|
name = name + '/index';
|
||||||
|
|
||||||
|
if (!registry[name]) {
|
||||||
|
throw new Error('Could not find module ' + name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var mod = registry[name];
|
var mod = registry[name];
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/* jshint node: true */
|
/* jshint node: true */
|
||||||
|
|
||||||
import '../setup-browser';
|
import '../support/node';
|
||||||
|
|
||||||
import {describeModule} from '../describe-module';
|
import {describeModule} from '../support/describe-module';
|
||||||
import 'tower/shared/Utilities';
|
import 'tower/shared/Utilities';
|
||||||
import 'tower/shared/RestServices';
|
import 'tower/shared/RestServices';
|
||||||
import JobStatusGraph from 'tower/dashboard/graphs/job-status/main';
|
import JobStatusGraph from 'tower/dashboard/graphs/job-status/main';
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import '../setup-browser';
|
import '../support/node';
|
||||||
|
|
||||||
import featuresController from 'tower/shared/features/features.controller';
|
import featuresController from 'tower/shared/features/features.controller';
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import '../setup-browser';
|
import '../support/node';
|
||||||
|
|
||||||
import features from 'tower/shared/features/main';
|
import features from 'tower/shared/features/main';
|
||||||
import {describeModule} from '../describe-module';
|
import {describeModule} from '../support/describe-module';
|
||||||
|
|
||||||
//test that it returns features, as well as test that it is returned in rootScope
|
//test that it returns features, as well as test that it is returned in rootScope
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import '../setup-browser';
|
import '../support/node';
|
||||||
|
|
||||||
import jobTemplates from 'tower/job-templates/main';
|
import jobTemplates from 'tower/job-templates/main';
|
||||||
import {describeModule} from '../describe-module';
|
import {describeModule} from '../support/describe-module';
|
||||||
|
|
||||||
describeModule(jobTemplates.name)
|
describeModule(jobTemplates.name)
|
||||||
.testService('deleteJobTemplate', function(test, restStub) {
|
.testService('deleteJobTemplate', function(test, restStub) {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import '../setup-browser';
|
import '../support/node';
|
||||||
|
|
||||||
import {describeModule} from '../describe-module';
|
import {describeModule} from '../support/describe-module';
|
||||||
import mod from 'tower/shared/multi-select-list/main';
|
import mod from 'tower/shared/multi-select-list/main';
|
||||||
|
|
||||||
describeModule(mod.name)
|
describeModule(mod.name)
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import '../setup-browser';
|
import '../support/node';
|
||||||
|
|
||||||
import {describeModule} from '../describe-module';
|
import {describeModule} from '../support/describe-module';
|
||||||
import mod from 'tower/shared/multi-select-list/main';
|
import mod from 'tower/shared/multi-select-list/main';
|
||||||
|
|
||||||
var mockController = {
|
var mockController = {
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
// Phantom.js is missing the standard Function.prototype.bind
|
|
||||||
// function. See https://code.google.com/p/phantomjs/issues/detail?id=522
|
|
||||||
// for more details.
|
|
||||||
//
|
|
||||||
if (!Function.prototype.bind) {
|
|
||||||
Function.prototype.bind = function(oThis) {
|
|
||||||
if (typeof this !== 'function') {
|
|
||||||
// closest thing possible to the ECMAScript 5
|
|
||||||
// internal IsCallable function
|
|
||||||
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
|
|
||||||
}
|
|
||||||
|
|
||||||
var aArgs = Array.prototype.slice.call(arguments, 1),
|
|
||||||
fToBind = this,
|
|
||||||
fNOP = function() {},
|
|
||||||
fBound = function() {
|
|
||||||
return fToBind.apply(this instanceof fNOP
|
|
||||||
? this
|
|
||||||
: oThis,
|
|
||||||
aArgs.concat(Array.prototype.slice.call(arguments)));
|
|
||||||
};
|
|
||||||
|
|
||||||
fNOP.prototype = this.prototype;
|
|
||||||
fBound.prototype = new fNOP();
|
|
||||||
|
|
||||||
return fBound;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import '../setup-browser';
|
import '../support/node';
|
||||||
|
|
||||||
import {describeModule} from '../describe-module';
|
import {describeModule} from '../support/describe-module';
|
||||||
import JobStatusGraph from 'tower/dashboard/graphs/job-status/main';
|
import JobStatusGraph from 'tower/dashboard/graphs/job-status/main';
|
||||||
|
|
||||||
var processErrors = sinon.spy();
|
var processErrors = sinon.spy();
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import '../setup-browser';
|
import '../support/node';
|
||||||
|
|
||||||
import 'tower/shared/main';
|
import 'tower/shared/main';
|
||||||
|
|
||||||
4
awx/ui/tests/support/node/export-global.js
Normal file
4
awx/ui/tests/support/node/export-global.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
module.exports =
|
||||||
|
function exportGlobal(varName, value) {
|
||||||
|
global[varName] = global.window[varName] = value;
|
||||||
|
};
|
||||||
26
awx/ui/tests/support/node/index.js
Normal file
26
awx/ui/tests/support/node/index.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/* jshint node: true */
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var isNode = typeof window === 'undefined';
|
||||||
|
|
||||||
|
if (!isNode) {
|
||||||
|
window.expect = chai.expect;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
require('./setup/jsdom');
|
||||||
|
require('./setup/mocha');
|
||||||
|
require('./setup/jquery');
|
||||||
|
require('./setup/angular');
|
||||||
|
require('./setup/angular-mocks');
|
||||||
|
require('./setup/angular-templates');
|
||||||
|
require('./setup/sinon');
|
||||||
|
require('./setup/chai');
|
||||||
|
require('./setup/chai-plugins');
|
||||||
|
require('./setup/d3');
|
||||||
|
require('./setup/nv');
|
||||||
|
require('./setup/lodash');
|
||||||
|
require('./setup/local-storage');
|
||||||
|
require('./setup/moment');
|
||||||
|
|
||||||
|
})();
|
||||||
5
awx/ui/tests/support/node/setup/angular-mocks.js
vendored
Normal file
5
awx/ui/tests/support/node/setup/angular-mocks.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
var exportGlobal = require('../export-global');
|
||||||
|
require('angular-mocks/angular-mocks');
|
||||||
|
|
||||||
|
exportGlobal('inject', window.inject);
|
||||||
|
|
||||||
2
awx/ui/tests/support/node/setup/angular-templates.js
vendored
Normal file
2
awx/ui/tests/support/node/setup/angular-templates.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
angular.module('templates', []);
|
||||||
|
require('../../../../templates');
|
||||||
5
awx/ui/tests/support/node/setup/angular.js
vendored
Normal file
5
awx/ui/tests/support/node/setup/angular.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
var exportGlobal = require('../export-global');
|
||||||
|
require('angular/angular');
|
||||||
|
|
||||||
|
exportGlobal('angular', window.angular);
|
||||||
|
|
||||||
8
awx/ui/tests/support/node/setup/chai-plugins.js
Normal file
8
awx/ui/tests/support/node/setup/chai-plugins.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
var sinonChai = require('sinon-chai');
|
||||||
|
var chaiAsPromised = require('chai-as-promised');
|
||||||
|
var chaiThings = require('chai-things');
|
||||||
|
|
||||||
|
chai.use(sinonChai);
|
||||||
|
chai.use(chaiAsPromised);
|
||||||
|
chai.use(chaiThings);
|
||||||
|
|
||||||
5
awx/ui/tests/support/node/setup/chai.js
Normal file
5
awx/ui/tests/support/node/setup/chai.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
var exportGlobal = require('../export-global');
|
||||||
|
var chai = require('chai');
|
||||||
|
|
||||||
|
exportGlobal('chai', chai);
|
||||||
|
exportGlobal('expect', chai.expect);
|
||||||
6
awx/ui/tests/support/node/setup/d3.js
vendored
Normal file
6
awx/ui/tests/support/node/setup/d3.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
var exportGlobal = require('../export-global');
|
||||||
|
var d3 = require('d3');
|
||||||
|
|
||||||
|
exportGlobal('d3', d3);
|
||||||
|
|
||||||
|
|
||||||
7
awx/ui/tests/support/node/setup/jquery.js
vendored
Normal file
7
awx/ui/tests/support/node/setup/jquery.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
var exportGlobal = require('../export-global');
|
||||||
|
var jquery = require('jquery');
|
||||||
|
|
||||||
|
exportGlobal('$', jquery);
|
||||||
|
exportGlobal('jQuery', jquery);
|
||||||
|
|
||||||
|
|
||||||
6
awx/ui/tests/support/node/setup/jsdom.js
Normal file
6
awx/ui/tests/support/node/setup/jsdom.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
var jsdom = require('jsdom').jsdom;
|
||||||
|
var document = jsdom('tower');
|
||||||
|
var window = document.parentWindow;
|
||||||
|
|
||||||
|
global.document = document;
|
||||||
|
global.window = window;
|
||||||
7
awx/ui/tests/support/node/setup/local-storage.js
Normal file
7
awx/ui/tests/support/node/setup/local-storage.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
var exportGlobal = require('../export-global');
|
||||||
|
var LocalStorage = require('node-localstorage').LocalStorage;
|
||||||
|
|
||||||
|
exportGlobal('localStorage',
|
||||||
|
new LocalStorage('./scratch'));
|
||||||
|
|
||||||
|
|
||||||
4
awx/ui/tests/support/node/setup/lodash.js
Normal file
4
awx/ui/tests/support/node/setup/lodash.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
var exportGlobal = require('../export-global');
|
||||||
|
var lodash = require('lodash');
|
||||||
|
|
||||||
|
exportGlobal('_', lodash);
|
||||||
7
awx/ui/tests/support/node/setup/mocha.js
Normal file
7
awx/ui/tests/support/node/setup/mocha.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
var exportGlobal = require('../export-global');
|
||||||
|
var mocha = require('mocha');
|
||||||
|
|
||||||
|
exportGlobal('mocha', mocha);
|
||||||
|
exportGlobal('beforeEach', beforeEach);
|
||||||
|
exportGlobal('afterEach', afterEach);
|
||||||
|
|
||||||
5
awx/ui/tests/support/node/setup/moment.js
Normal file
5
awx/ui/tests/support/node/setup/moment.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
var exportGlobal = require('../export-global');
|
||||||
|
var moment = require('moment');
|
||||||
|
|
||||||
|
exportGlobal('moment', moment);
|
||||||
|
|
||||||
6
awx/ui/tests/support/node/setup/nv.js
Normal file
6
awx/ui/tests/support/node/setup/nv.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
var exportGlobal = require('../export-global');
|
||||||
|
var nv = require('nvd3');
|
||||||
|
|
||||||
|
exportGlobal('nv', nv);
|
||||||
|
|
||||||
|
|
||||||
4
awx/ui/tests/support/node/setup/sinon.js
Normal file
4
awx/ui/tests/support/node/setup/sinon.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
var exportGlobal = require('../export-global');
|
||||||
|
var sinon = require('sinon');
|
||||||
|
|
||||||
|
exportGlobal('sinon', sinon);
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/* jshint node: true */
|
/* jshint node: true */
|
||||||
|
|
||||||
import '../../setup-browser';
|
import '../../support/node';
|
||||||
|
|
||||||
import compareFacts from 'tower/system-tracking/compare-facts/flat';
|
import compareFacts from 'tower/system-tracking/compare-facts/flat';
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/* jshint node: true */
|
/* jshint node: true */
|
||||||
|
|
||||||
import '../../setup-browser';
|
import '../../support/node';
|
||||||
|
|
||||||
import compareFacts from 'tower/system-tracking/compare-facts/nested';
|
import compareFacts from 'tower/system-tracking/compare-facts/nested';
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import '../setup-browser';
|
import '../support/node';
|
||||||
|
|
||||||
import systemTracking from 'tower/system-tracking/data-services/main';
|
import systemTracking from 'tower/system-tracking/data-services/main';
|
||||||
import {describeModule} from '../describe-module';
|
import {describeModule} from '../support/describe-module';
|
||||||
import moment from 'tower/shared/moment/moment';
|
import moment from 'tower/shared/moment/moment';
|
||||||
|
|
||||||
describeModule(systemTracking.name)
|
describeModule(systemTracking.name)
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
/* jshint node: true */
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
var isNode = typeof window === 'undefined';
|
|
||||||
|
|
||||||
if (!isNode) {
|
|
||||||
window.expect = chai.expect;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setupNode();
|
|
||||||
|
|
||||||
function setupNode() {
|
|
||||||
|
|
||||||
var jsdom = require('jsdom').jsdom;
|
|
||||||
var document = jsdom('tower');
|
|
||||||
var window = document.parentWindow;
|
|
||||||
var mocha = require('mocha');
|
|
||||||
window.mocha = mocha;
|
|
||||||
window.beforeEach = beforeEach;
|
|
||||||
window.afterEach = afterEach;
|
|
||||||
|
|
||||||
global.document = document;
|
|
||||||
global.window = window;
|
|
||||||
|
|
||||||
var jquery = require('jquery');
|
|
||||||
global.$ = window.$ = global.jQuery = window.jQuery = jquery;
|
|
||||||
|
|
||||||
require('angular/angular');
|
|
||||||
|
|
||||||
require('angular-mocks/angular-mocks');
|
|
||||||
|
|
||||||
var chai = require('chai');
|
|
||||||
var expect = chai.expect;
|
|
||||||
var sinonChai = require('sinon-chai');
|
|
||||||
var chaiAsPromised = require('chai-as-promised');
|
|
||||||
var sinon = require('sinon');
|
|
||||||
var chaiThings = require('chai-things');
|
|
||||||
|
|
||||||
chai.use(sinonChai);
|
|
||||||
chai.use(chaiAsPromised);
|
|
||||||
chai.use(chaiThings);
|
|
||||||
|
|
||||||
global.angular = window.angular;
|
|
||||||
global.inject = window.inject;
|
|
||||||
global.expect = chai.expect;
|
|
||||||
global.sinon = require('sinon');
|
|
||||||
|
|
||||||
angular.module('templates', []);
|
|
||||||
require('../../templates');
|
|
||||||
|
|
||||||
var d3 = require('d3');
|
|
||||||
global.d3 = d3;
|
|
||||||
|
|
||||||
var nv = require('nvd3');
|
|
||||||
global.nv = nv;
|
|
||||||
|
|
||||||
var lodash = require('lodash');
|
|
||||||
global._ = lodash;
|
|
||||||
|
|
||||||
var LocalStorage = require('node-localstorage').LocalStorage;
|
|
||||||
global.localStorage = window.localStorage = new LocalStorage('./scratch');
|
|
||||||
|
|
||||||
var moment = require('moment');
|
|
||||||
window.moment = moment;
|
|
||||||
}
|
|
||||||
|
|
||||||
})();
|
|
||||||
Reference in New Issue
Block a user