From 67773bd370723614b54ce2e13cc1b8a7dd4f1bbf Mon Sep 17 00:00:00 2001 From: Sahar Jafari Date: Mon, 16 May 2016 22:50:40 -0700 Subject: [PATCH] Fix relative paths and some tests --- scripts/components.js | 3 -- scripts/config/app.config.js | 8 ----- test/unit/index.js | 40 ++++++++++++------------ test/unit/karma.conf.js | 8 +++++ test/unit/spec/directives/schemamodel.js | 9 ++++-- 5 files changed, 34 insertions(+), 34 deletions(-) delete mode 100644 scripts/config/app.config.js diff --git a/scripts/components.js b/scripts/components.js index 2b9f03b55f8..cc261686bb6 100644 --- a/scripts/components.js +++ b/scripts/components.js @@ -5,9 +5,6 @@ * This file helps loading components easier in tests */ -// Configurations -require('scripts/config/app.config.js'); - // Router require('scripts/router'); diff --git a/scripts/config/app.config.js b/scripts/config/app.config.js deleted file mode 100644 index da42b10db8e..00000000000 --- a/scripts/config/app.config.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; - -var _ = require('lodash'); - -// Use single curly brace for templates (used in spec) -_.templateSettings = { - interpolate: /\{(.+?)\}/g -}; diff --git a/test/unit/index.js b/test/unit/index.js index 5dc67dcc6b6..a82b4c513ee 100644 --- a/test/unit/index.js +++ b/test/unit/index.js @@ -22,29 +22,29 @@ window.SwaggerEditor = angular.module('SwaggerEditor', [ ]); // Require app components -require('../../scripts/components'); +require('scripts/components.js'); // Test config -require('./defaults.js'); +require('defaults.js'); // Load tests -require('./spec/controllers/editor'); -require('./spec/controllers/errorpresenter'); -require('./spec/controllers/file-import'); -require('./spec/controllers/main'); -require('./spec/controllers/openexamples'); -require('./spec/controllers/preview'); -require('./spec/controllers/tryoperation'); -require('./spec/controllers/url-import'); +require('spec/controllers/editor'); +require('spec/controllers/errorpresenter'); +require('spec/controllers/file-import'); +require('spec/controllers/main'); +require('spec/controllers/openexamples'); +require('spec/controllers/preview'); +require('spec/controllers/tryoperation'); +require('spec/controllers/url-import'); -require('./spec/directives/collapsewhen'); -require('./spec/directives/schemamodel'); +require('spec/directives/collapsewhen'); +require('spec/directives/schemamodel'); -require('./spec/services/ast-manager'); -require('./spec/services/autocomplete'); -require('./spec/services/backend'); -require('./spec/services/builder'); -require('./spec/services/editor'); -require('./spec/services/fileloader'); -require('./spec/services/fold-state-manager'); -require('./spec/services/storage'); +require('spec/services/ast-manager'); +require('spec/services/autocomplete'); +require('spec/services/backend'); +require('spec/services/builder'); +require('spec/services/editor'); +require('spec/services/fileloader'); +require('spec/services/fold-state-manager'); +require('spec/services/storage'); diff --git a/test/unit/karma.conf.js b/test/unit/karma.conf.js index b1658eef69f..8de20af1429 100644 --- a/test/unit/karma.conf.js +++ b/test/unit/karma.conf.js @@ -1,6 +1,8 @@ // Karma configuration // http://karma-runner.github.io/0.10/config/configuration-file.html +var path = require("path"); + var webpackConfig = require('../../webpack.config.js'); module.exports = function(config) { @@ -35,6 +37,12 @@ module.exports = function(config) { webpack: { module: { loaders: webpackConfig.module.loaders + }, + resolve: { + root: [ + __dirname, + path.join(__dirname, '../../') + ] } }, diff --git a/test/unit/spec/directives/schemamodel.js b/test/unit/spec/directives/schemamodel.js index 9818ee263c5..a924c7f422a 100644 --- a/test/unit/spec/directives/schemamodel.js +++ b/test/unit/spec/directives/schemamodel.js @@ -13,9 +13,12 @@ describe('Directive: schemaModel', function() { scope = $rootScope.$new(); })); - it('should make hidden element visible', inject(function($compile) { - element = angular.element(''); + it('should render', inject(function($compile) { + scope.stringSchema = {type: 'string'}; + element = angular.element( + '' + ); element = $compile(element)(scope); - expect(element.text()).to.equal(''); + expect(element.text()).to.contain('⇄'); })); });