var cheerio = require('cheerio'); var addHeadingId = require('../addHeadingId'); describe('addHeadingId', function() { it('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 !!

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

Hello World

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

Hello World

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