Permalink
Browse files

Added check to ensure package.json name is correctly set to parent fo…

…lder name
  • Loading branch information...
1 parent 1be7efe commit b47457181717125ec69ad8d8105697e04159c9e3 @ryankirkman ryankirkman committed Dec 31, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 test/valid-packages-test.js
@@ -100,6 +100,13 @@ packages.map(function (pkg) {
assert.ok(fs.existsSync(filePath),
filePath +" does not exist but is referenced in package.json!");
};
+ package_vows[pname + ": name in package.json should be parent folder name"] = function (pkg) {
+ var json = parse(pkg, true, true);
+ var dirs = pkg.split("/");
+ var trueName = dirs[dirs.length - 2];
+ assert.ok(trueName == json.name,
+ pkg_name(pkg) + ": Name property should be '" + trueName + "', not '" + json.name +"'");
+ };
context[pname] = package_vows;
suite.addBatch(context);

0 comments on commit b474571

Please sign in to comment.