diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-12-22 13:12:16 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-12-22 13:12:16 +0100 |
commit | 97f2c333a87b9d939b5a7dc2884590c971b53291 (patch) | |
tree | a22824b02d84a89e59c458c8af7d3494561d43f6 /packages/gitbook-html/test/glossary.js | |
parent | 627e6dd866f77ff497a21f0b706490b82e40ea0e (diff) | |
download | gitbook-97f2c333a87b9d939b5a7dc2884590c971b53291.zip gitbook-97f2c333a87b9d939b5a7dc2884590c971b53291.tar.gz gitbook-97f2c333a87b9d939b5a7dc2884590c971b53291.tar.bz2 |
Import and adapt gitbook-html
Refactor to remove lodash and q as dependencies
Diffstat (limited to 'packages/gitbook-html/test/glossary.js')
-rwxr-xr-x | packages/gitbook-html/test/glossary.js | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/packages/gitbook-html/test/glossary.js b/packages/gitbook-html/test/glossary.js index 8bd77d6..e7175ea 100755 --- a/packages/gitbook-html/test/glossary.js +++ b/packages/gitbook-html/test/glossary.js @@ -1,29 +1,29 @@ -var fs = require('fs'); -var path = require('path'); -var assert = require('assert'); +const fs = require('fs'); +const path = require('path'); +const expect = require('expect'); -var glossary = require('../').glossary; +const glossary = require('../src').glossary; -describe('Glossary parsing', function () { - var LEXED; +describe('Glossary', () => { + let LEXED; - before(function() { - var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/GLOSSARY.html'), 'utf8'); + before(() => { + const CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/GLOSSARY.html'), 'utf8'); LEXED = glossary(CONTENT); }); - it('should only get heading + paragraph pairs', function() { - assert.equal(LEXED.length, 5); + it('should only get heading + paragraph pairs', () => { + expect(LEXED.length).toBe(5); }); - it('should output simple name/description objects', function() { - assert.equal(true, !(LEXED.some(function(e) { - return !Boolean(e.name && e.description); - }))); + it('should output simple name/description objects', () => { + expect(!(LEXED.some(e => !Boolean(e.name && e.description)))).toBe(true); }); - it('should correctly convert it to text', function() { - var text = glossary.toText(LEXED); - assertObjectsEqual(glossary(text), LEXED); + it('should correctly convert it to text', () => { + const text = glossary.toText(LEXED); + const parsed = glossary(text); + + expect(parsed).toEqual(LEXED); }); }); |