Permalink
Browse files

Modified unit tester class

  • Loading branch information...
1 parent c0ca3cd commit d98ec8a3a5cf23b27f939cb54e4d8ac48b2fde80 @oliverjohnstone oliverjohnstone committed Jun 18, 2012
Showing with 40 additions and 43 deletions.
  1. +3 −2 lib/compact.js
  2. +37 −41 test/compact.test.js
View
@@ -11,7 +11,8 @@ module.exports.createCompact = function(options) {
options = _.extend({
webPath: '',
- debug: false
+ debug: false,
+ safeCompression: false // Added By Oliver TODO: Remove comment before push
}, options);
if (!path.existsSync(options.srcPath)) {
@@ -55,7 +56,7 @@ module.exports.createCompact = function(options) {
});
var namespace = namespaces[name];
- function addJs(filePath) {
+ function addJs(filePath, safe) {
if (!namespace.javascriptFiles) {
namespace.javascriptFiles = [];
}
View
@@ -42,46 +42,6 @@ describe('compact.js', function() {
});
});
- describe('#addNamespace()', function() {
- var compact;
-
- beforeEach(function() {
- compact = require('../../compact').createCompact({ srcPath: srcPath, destPath: destPath });
- });
-
- it('should fail on null', function() {
- (function() {
- compact.addNamespace(null);
- }).should.throw('Invalid namespace');
- });
-
- it('should succeed with valid namespace', function() {
- compact.addNamespace('global').addJs.should.be.a('function');
- });
-
- it('should add a source path to the lookup chain when given', function () {
-
- compact.addNamespace('alternative', altPath);
-
- // Lookup item in added path
- (function () {
- compact.ns.alternative.addJs('d.js');
- }).should.not.throw();
-
- // Lookup item in default path
- (function () {
- compact.ns.alternative.addJs('a.js');
- }).should.not.throw();
-
- // Lookup item that doesn't exist in either path
- (function () {
- compact.ns.alternative.addJs('xyz.js');
- }).should.throw('Unable to find \'xyz.js\'');
-
- });
-
- });
-
describe('Namespace', function() {
var namespace
@@ -133,8 +93,44 @@ describe('compact.js', function() {
compact.addNamespace('foo');
}).should.throw('The namespace \'foo\' has already been added');
});
- });
+
+ var compact;
+
+ beforeEach(function() {
+ compact = require('../../compact').createCompact({ srcPath: srcPath, destPath: destPath });
+ });
+
+ it('should fail on null', function() {
+ (function() {
+ compact.addNamespace(null);
+ }).should.throw('Invalid namespace');
+ });
+
+ it('should succeed with valid namespace', function() {
+ compact.addNamespace('global').addJs.should.be.a('function');
+ });
+
+ it('should add a source path to the lookup chain when given', function () {
+ compact.addNamespace('alternative', altPath);
+
+ // Lookup item in added path
+ (function () {
+ compact.ns.alternative.addJs('d.js');
+ }).should.not.throw();
+
+ // Lookup item in default path
+ (function () {
+ compact.ns.alternative.addJs('a.js');
+ }).should.not.throw();
+
+ // Lookup item that doesn't exist in either path
+ (function () {
+ compact.ns.alternative.addJs('xyz.js');
+ }).should.throw('Unable to find \'xyz.js\'');
+
+ });
+ });
});
describe('#js()', function() {

0 comments on commit d98ec8a

Please sign in to comment.