summaryrefslogtreecommitdiffstats
path: root/lib/models/__tests__/page.js
blob: 15a13ad5fec40f0d55c1791f0b54fbf597a148ff (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
var Immutable = require('immutable');
var Page = require('../page');

describe('Page', function() {

    describe('toText', function() {
        it('must not prepend frontmatter if no attributes', function() {
            var page = Page().merge({
                content: 'Hello World'
            });

            expect(page.toText()).toBe('Hello World');
        });

        it('must prepend frontmatter if attributes', function() {
            var page = Page().merge({
                content: 'Hello World',
                attributes: Immutable.fromJS({
                    hello: 'world'
                })
            });

            expect(page.toText()).toBe('---\nhello: world\n---\nHello World\n');
        });
    });
});