Skip to content

Commit

Permalink
unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Balestra committed Jan 13, 2017
1 parent f5cb1eb commit 843b471
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 266 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = function externalDependenciesHandlers(dependencies){

return [
function(context, req, callback) {
if (/^[a-z@][a-z\-\/0-9]+$/.test(req)) {
if (/^[a-z@][a-z\-\/0-9]+$/i.test(req)) {
var dependencyName = req;
if (/\//g.test(dependencyName)) {
dependencyName = dependencyName.substring(0, dependencyName.indexOf('/'));
Expand All @@ -31,7 +31,7 @@ module.exports = function externalDependenciesHandlers(dependencies){
}
callback();
},
/^[a-z@][a-z\-\/0-9]+$/
/^[a-z@][a-z\-\/0-9]+$/i
];
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function wrapLoops(node){

if(loopKeywords.indexOf(node.type) > -1){
node.update(
'var __ITER = ' + CONST_MAX_ITERATIONS + ';\n'
'var __ITER = ' + CONST_MAX_ITERATIONS + ';'
+ node.source()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,32 @@ describe('cli : domain : package-server-script', function(){
});

it('should throw an error with error details', function(done){
packageServerScript(
{
componentPath: componentPath,
ocOptions: {
files: {
data: serverName
}
try {
packageServerScript(
{
componentPath: componentPath,
ocOptions: {
files: {
data: serverName
}
},
publishPath: publishPath,
webpack: webpackOptions
},
publishPath: publishPath,
webpack: webpackOptions
},
function(err, res){
try {
expect(err.toString()).to.contain.contain('Unexpected token, expected , (3:19)');
return done();
} catch(e) {
return done(e);
function(err, res){
try {
expect(err.toString()).to.contain.contain('Unexpected token, expected , (3:19)');
return done();
} catch(e) {
return done(e);
}
return done('error');
}
return done('error');
}
);
);
} catch (e) {
expect(e).to.contain.contain('Unexpected token, expected , (3:19)');
done();
}
});
});

Expand Down
Loading

0 comments on commit 843b471

Please sign in to comment.