From 794ce9831bdee216c39cb1cd74b8715f4cbc46fb Mon Sep 17 00:00:00 2001 From: Michael Mathews Date: Sun, 27 Jun 2010 21:34:02 +0100 Subject: [PATCH] Added tests for jsdoc/docset. --- test/runall.js | 1 + test/tests/03_jsdoc_parser.js | 2 +- test/tests/04_jsdoc_docset.js | 40 +++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 test/tests/04_jsdoc_docset.js diff --git a/test/runall.js b/test/runall.js index 5d62e0cd..952bd0a2 100644 --- a/test/runall.js +++ b/test/runall.js @@ -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({ diff --git a/test/tests/03_jsdoc_parser.js b/test/tests/03_jsdoc_parser.js index a1901cd9..1201f966 100644 --- a/test/tests/03_jsdoc_parser.js +++ b/test/tests/03_jsdoc_parser.js @@ -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'); }); diff --git a/test/tests/04_jsdoc_docset.js b/test/tests/04_jsdoc_docset.js new file mode 100644 index 00000000..8fd4102f --- /dev/null +++ b/test/tests/04_jsdoc_docset.js @@ -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 */ + +})(); \ No newline at end of file