| 
									
										
										
										
											2018-03-14 19:15:11 +00:00
										 |  |  | const testPackage = require('../../helpers/test-package'); | 
					
						
							|  |  |  | const Dgeni = require('dgeni'); | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | describe('addNotYetDocumentedProperty', function() { | 
					
						
							| 
									
										
										
										
											2018-03-14 19:15:11 +00:00
										 |  |  |   let processor; | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   beforeEach(function() { | 
					
						
							| 
									
										
										
										
											2018-03-14 19:15:11 +00:00
										 |  |  |     const dgeni = new Dgeni([testPackage('angular-api-package')]); | 
					
						
							|  |  |  |     const injector = dgeni.configureInjector(); | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |     processor = injector.get('addNotYetDocumentedProperty'); | 
					
						
							| 
									
										
										
										
											2018-03-14 19:15:11 +00:00
										 |  |  |     processor.docTypes = ['test']; | 
					
						
							|  |  |  |     processor.properties = ['description', 'name']; | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-14 19:15:11 +00:00
										 |  |  |   it('should run at the right time', () => { | 
					
						
							|  |  |  |     expect(processor.$runAfter).toEqual(['tags-extracted']); | 
					
						
							|  |  |  |     expect(processor.$runBefore).toEqual(['processing-docs', 'splitDescription']); | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-14 19:15:11 +00:00
										 |  |  |   it('should mark docs with no `description` property as "not yet documented"', () => { | 
					
						
							|  |  |  |     const docs = [ | 
					
						
							|  |  |  |       {id: 'a', docType: 'test', description: 'some content' }, | 
					
						
							|  |  |  |       {id: 'b', docType: 'test', description: '' }, | 
					
						
							|  |  |  |       {id: 'c', docType: 'test' }, | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     processor.$process(docs); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-14 19:15:11 +00:00
										 |  |  |     expect(docs[0].notYetDocumented).toBeFalsy(); | 
					
						
							|  |  |  |     expect(docs[1].notYetDocumented).toBeTruthy(); | 
					
						
							|  |  |  |     expect(docs[2].notYetDocumented).toBeTruthy(); | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-14 19:15:11 +00:00
										 |  |  |   it('should ignore docs that do not match the specified doc types', () => { | 
					
						
							|  |  |  |     const docs = [ | 
					
						
							|  |  |  |       {id: 'a', docType: 'other', description: '' }, | 
					
						
							|  |  |  |       {id: 'b', docType: 'other', shortDescription: '' }, | 
					
						
							|  |  |  |       {id: 'c', docType: 'other' }, | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     processor.$process(docs); | 
					
						
							| 
									
										
										
										
											2018-03-14 19:15:11 +00:00
										 |  |  |     expect(docs[0].notYetDocumented).toBeFalsy(); | 
					
						
							|  |  |  |     expect(docs[1].notYetDocumented).toBeFalsy(); | 
					
						
							|  |  |  |     expect(docs[2].notYetDocumented).toBeFalsy(); | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-07 16:55:17 -07:00
										 |  |  |   it('should not mark documents explicitly tagged as `@noDescription`', function() { | 
					
						
							| 
									
										
										
										
											2018-03-14 19:15:11 +00:00
										 |  |  |     const docs = [ | 
					
						
							|  |  |  |       {id: 'a', docType: 'other', description: '', noDescription: true }, | 
					
						
							|  |  |  |       {id: 'b', docType: 'other', shortDescription: '', noDescription: true }, | 
					
						
							|  |  |  |       {id: 'c', docType: 'other', noDescription: true }, | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     processor.$process(docs); | 
					
						
							| 
									
										
										
										
											2018-03-14 19:15:11 +00:00
										 |  |  |     expect(docs[0].notYetDocumented).toBeFalsy(); | 
					
						
							|  |  |  |     expect(docs[1].notYetDocumented).toBeFalsy(); | 
					
						
							|  |  |  |     expect(docs[2].notYetDocumented).toBeFalsy(); | 
					
						
							| 
									
										
										
										
											2017-01-26 14:03:53 +00:00
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2017-04-01 21:34:10 +03:00
										 |  |  | }); |