1 | var fs = require('fs');
|
2 | var path = require('path');
|
3 | var assert = require('assert');
|
4 |
|
5 | var nav = require('../../src/parse/nav.js');
|
6 |
|
7 | describe('Nav parsing', function(){
|
8 | var LEXED;
|
9 | var LEXED_EMPTY;
|
10 |
|
11 | before(function() {
|
12 | var content = fs.readFileSync(
|
13 | path.join(__dirname, './fixtures/nav.html'), 'utf8');
|
14 | LEXED = nav(content);
|
15 | var contentEmpty = fs.readFileSync(
|
16 | path.join(__dirname, './fixtures/nav-empty.html'), 'utf8'
|
17 | )
|
18 | LEXED_EMPTY = nav(contentEmpty);
|
19 | });
|
20 |
|
21 | describe('Parts', function(){
|
22 | it('title', function(){
|
23 | assert.equal(LEXED.title, 'YDoc')
|
24 | })
|
25 | it('logo', function(){
|
26 | assert.equal(LEXED.logo, 'style/images/logo.png')
|
27 | })
|
28 | it('menusLengh', function(){
|
29 | assert.equal(LEXED.menus[0].items.length, 4)
|
30 | })
|
31 | it('menusContent', function(){
|
32 | assert.equal(LEXED.menus[0].items[2].ref, 'documents/index.html')
|
33 | })
|
34 | })
|
35 |
|
36 | describe('Empty Parts', function(){
|
37 | it('menus is array', function(){
|
38 | assert.equal(LEXED_EMPTY.menus.length, 0);
|
39 | })
|
40 | })
|
41 | }) |
\ | No newline at end of file |