Added tests for jsdoc/docset.

This commit is contained in:
Michael Mathews 2010-06-27 21:34:02 +01:00
parent 1a6a90320e
commit 794ce9831b
3 changed files with 42 additions and 1 deletions

View File

@ -1,6 +1,7 @@
load(BASEDIR + '/test/tests/01_jsdoc_opts.js');
load(BASEDIR + '/test/tests/02_jsdoc_src.js');
load(BASEDIR + '/test/tests/03_jsdoc_parser.js');
load(BASEDIR + '/test/tests/04_jsdoc_docset.js');
// see http://visionmedia.github.com/jspec/
JSpec.run({

View File

@ -29,7 +29,7 @@
expect(jsdoc.parser.result).to(have_length, 1);
});
it('should be set be populated by doclets', function() {
it('should be populated by doclets', function() {
jsdoc.parser.parseFiles(BASEDIR + 'test/tests/03_jsdoc_parser.js');
expect(jsdoc.parser.result[0].constructor.name).to(eql, 'Doclet');
});

View File

@ -0,0 +1,40 @@
(function() {
var jsdoc;
JSpec.describe('jsdoc/docset.js', function() {
before_each(function() {
// docsets can only be created by parsers
jsdoc = { parser: require('jsdoc/parser') };
jsdoc.parser.parseFiles(BASEDIR + 'test/tests/04_jsdoc_docset.js');
});
describe('The docset object', function() {
it('should be an array', function() {
expect(jsdoc.parser.result).to(be_an, Array);
});
it('should have a `toObject` method', function() {
expect(jsdoc.parser.result).to(respond_to, 'toObject');
});
it('should have a `toString` method', function() {
expect(jsdoc.parser.result).to(respond_to, 'toString');
});
it('should have a `toJSON` method', function() {
expect(jsdoc.parser.result).to(respond_to, 'toJSON');
});
it('should have a `toXML` method', function() {
expect(jsdoc.parser.result).to(respond_to, 'toXML');
});
});
});
})();
(function testarea() {
/** @constructor Foo */
})();