summaryrefslogtreecommitdiffstats
path: root/lib/models/__tests__
diff options
context:
space:
mode:
Diffstat (limited to 'lib/models/__tests__')
-rw-r--r--lib/models/__tests__/page.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/models/__tests__/page.js b/lib/models/__tests__/page.js
new file mode 100644
index 0000000..15a13ad
--- /dev/null
+++ b/lib/models/__tests__/page.js
@@ -0,0 +1,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');
+ });
+ });
+});
+
+