jest.autoMockOff(); var cheerio = require('cheerio'); describe('addHeadingId', function() { var addHeadingId = require('../addHeadingId'); pit('should add an ID if none', function() { var $ = cheerio.load('

Hello World

Cool !!

'); return addHeadingId($) .then(function() { var html = $.html(); expect(html).toBe('

Hello World

Cool !!

'); }); }); pit('should not change existing IDs', function() { var $ = cheerio.load('

Hello World

'); return addHeadingId($) .then(function() { var html = $.html(); expect(html).toBe('

Hello World

'); }); }); });