blob: 55a445e3d50640a41c1203e48a5ebba19dd2ce0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
var Book = require('../../models/book');
var createMockFS = require('../../fs/mock');
describe('parseSummary', function() {
var parseSummary = require('../parseSummary');
it('should parse summary if exists', function() {
var fs = createMockFS({
'SUMMARY.md': '# Summary\n\n* [Hello](hello.md)'
});
var book = Book.createForFS(fs);
return parseSummary(book)
.then(function(resultBook) {
var summary = resultBook.getSummary();
var file = summary.getFile();
expect(file.exists()).toBeTruthy();
});
});
it('should not fail if doesn\'t exist', function() {
var fs = createMockFS({});
var book = Book.createForFS(fs);
return parseSummary(book)
.then(function(resultBook) {
var summary = resultBook.getSummary();
var file = summary.getFile();
expect(file.exists()).toBeFalsy();
});
});
});
|