aboutsummaryrefslogtreecommitdiffstats
path: root/docs/spec/ngdocSpec.js
diff options
context:
space:
mode:
authorVojta Jina2011-05-17 22:12:23 +0200
committerIgor Minar2011-06-06 22:51:59 -0700
commit2e0e732cadd86846b57b7b02b3303a2e0e3b842a (patch)
treed18acaed3f04decb5e4305386b32e4a2097ba0f9 /docs/spec/ngdocSpec.js
parent22f9354c211b032c3da3c8e1320a3fa1106e3ffd (diff)
downloadangular.js-2e0e732cadd86846b57b7b02b3303a2e0e3b842a.tar.bz2
Check whether links do exist and throw exception
Diffstat (limited to 'docs/spec/ngdocSpec.js')
-rw-r--r--docs/spec/ngdocSpec.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/docs/spec/ngdocSpec.js b/docs/spec/ngdocSpec.js
index 68d3700f..e8b8959d 100644
--- a/docs/spec/ngdocSpec.js
+++ b/docs/spec/ngdocSpec.js
@@ -96,6 +96,13 @@ describe('ngdoc', function(){
expect(doc.description).toContain('<p>before </p><doc:example>' +
'<pre class="doc-scenario">\n&lt;&gt;\n</pre></doc:example><p>after</p>');
});
+
+ it('should store all links', function() {
+ var doc = new Doc('@description {@link api/angular.link}');
+ doc.parse();
+
+ expect(doc.links).toContain('api/angular.link');
+ });
describe('sorting', function(){
function property(name) {
@@ -197,7 +204,37 @@ describe('ngdoc', function(){
expect(docs[0].methods).toEqual([methodA, methodB]);
expect(docs[0].properties).toEqual([propA, propB]);
});
+
+ describe('links checking', function() {
+ var docs;
+ beforeEach(function() {
+ docs = [new Doc({section: 'api', id: 'fake.id1', links: ['non-existing-link']}),
+ new Doc({section: 'api', id: 'fake.id2'}),
+ new Doc({section: 'api', id: 'fake.id3'})];
+ });
+
+ it('should throw exception when any link doesn\'t exist', function() {
+ expect(function() {
+ ngdoc.merge(docs);
+ }).toThrow();
+ });
+
+ it('should say which link doesn\'t exist', function() {
+ try {
+ ngdoc.merge(docs);
+ } catch (e) {
+ expect(e).toContain('non-existing-link');
+ }
+ });
+ it('should say where is the non-existing link', function() {
+ try {
+ ngdoc.merge(docs);
+ } catch (e) {
+ expect(e).toContain('api/fake.id1');
+ }
+ });
+ });
});
////////////////////////////////////////