Commits

Anonymous committed 3aff200

Started tests on existing bake recipes

Comments (0)

Files changed (9)

dist/amd/recipe.js

             this.requirements = value.split(reCommaDelim);
         }
     });
-    
+    // no extensions available for the targeted build platform
     
     exports.define = function(opts) {
     	return new Recipe(opts);

dist/glob/recipe.js

             this.requirements = value.split(reCommaDelim);
         }
     });
-    
+    // no extensions available for the targeted build platform
     
     exports.define = function(opts) {
     	return new Recipe(opts);
   },
   "devDependencies": {
     "expect.js": "0.1.x",
-    "mocha": "1.2.x"
+    "mocha": "1.2.x",
+    "sniff": "0.1.x"
   },
   "repository": {
     "type": "git",
 // req: formatter
 
 //= core/recipe
-//= core/{{ packageType }}/recipe-ext
+
+//= core/{{ packageType }}/recipe-ext  : core/recipe-noext
 
 exports.define = function(opts) {
 	return new Recipe(opts);
+var recipe = require('../dist/commonjs/recipe'),
+    assert = require('assert'),
+    fs = require('fs'),
+    path = require('path'),
+    recipePath = path.resolve(__dirname, 'recipes');
+
+describe('file based recipe tests', function() {
+    var files = fs.readdirSync(recipePath) || [];
+
+    files.forEach(function(file) {
+        var recipeText = fs.readFileSync(path.join(recipePath, file), 'utf8');
+
+        describe('validate "' + file + '" recipe', function() {
+            it('should have recipe text to parse', function() {
+                assert(recipeText);
+            });
+
+            require('./recipe-validators/' + file)(recipe.define(recipeText));
+        });
+    });
+});
 var recipe = require('../dist/commonjs/recipe'),
     expect = require('expect.js'),
+    sniff = require('sniff'),
     samples = {
         simple: '# dsc: small JS library for DOM class manipulation\n' +
                 '# url: https://github.com/DamonOehlman/classtweak\n' +
             core = testRecipe.sections.core;
         
         expect(core.js).to.be.ok();
-        expect(core.js).to.contain('github://DamonOehlman/classtweak/classtweak.js');
+        expect(sniff(core.js)).to.equal('array');
+        expect(core.js.length).to.equal(1);
+        expect(core.js[0]).to.equal('github://DamonOehlman/classtweak/classtweak.js');
     });
 });

test/recipe-validators/bootstrap.js

+var assert = require('assert');
+
+module.exports = function(recipe) {
+	// execute the core tests
+	require('./core')(recipe);
+
+	it('should have a valid name', function() {
+		assert.equal(recipe.desc, 'HTML, CSS, and JS toolkit from Twitter');
+	});
+};

test/recipe-validators/core.js

+module.exports = function(recipe) {
+	console.log(recipe);
+};

test/recipes/bootstrap

+# dsc: HTML, CSS, and JS toolkit from Twitter
+# author: twitter
+# url: http://twitter.github.com/bootstrap
+# src: https://github.com/twitter/bootstrap
+# bug: https://github.com/twitter/bootstrap/issues
+# req: jquery
+
+[core]
+css <= http://twitter.github.com/bootstrap/assets/css/bootstrap.css
+
+[addin]
+js <= github://twitter/bootstrap/js/bootstrap-$addin.js