const testPackage = require('../../helpers/test-package'); const processorFactory = require('./fixInternalDocumentLinks'); const Dgeni = require('dgeni'); describe('fixInternalDocumentLinks processor', () => { it('should be available on the injector', () => { const dgeni = new Dgeni([testPackage('angular.io-package')]); const injector = dgeni.configureInjector(); const processor = injector.get('fixInternalDocumentLinks'); expect(processor.$process).toBeDefined(); }); it('should run before the correct processor', () => { const processor = processorFactory(); expect(processor.$runBefore).toEqual(['writeFilesProcessor']) }); it('should run after the correct processor', () => { const processor = processorFactory(); expect(processor.$runAfter).toEqual(['inlineTagProcessor']); }); it('should prefix internal hash links with the current doc path', () => { const processor = processorFactory(); const docs = [ { path: 'some/doc', renderedContent: ` Google Some Id Link to heading Link to heading Link to heading ` }, ]; processor.$process(docs); expect(docs).toEqual([ { path: 'some/doc', renderedContent: ` Google Some Id Link to heading Link to heading Link to heading ` }, ]); }) });