summaryrefslogtreecommitdiffstats
path: root/lib/models/__tests__
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-06-10 18:08:55 +0200
committerSamy Pessé <samypesse@gmail.com>2016-06-10 18:08:56 +0200
commit59be32a54f86d047a19d64eaa084bcc61f11ee2f (patch)
treec988789a13e216deeabdbd391f97136859798be5 /lib/models/__tests__
parent4ae7cdb5d1598824c36e0fdb4f98ea3ac8152511 (diff)
downloadgitbook-59be32a54f86d047a19d64eaa084bcc61f11ee2f.zip
gitbook-59be32a54f86d047a19d64eaa084bcc61f11ee2f.tar.gz
gitbook-59be32a54f86d047a19d64eaa084bcc61f11ee2f.tar.bz2
Add method .createChildLevel for SummaryArticle
Diffstat (limited to 'lib/models/__tests__')
-rw-r--r--lib/models/__tests__/summaryArticle.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/models/__tests__/summaryArticle.js b/lib/models/__tests__/summaryArticle.js
new file mode 100644
index 0000000..7c4bc57
--- /dev/null
+++ b/lib/models/__tests__/summaryArticle.js
@@ -0,0 +1,23 @@
+var SummaryArticle = require('../summaryArticle');
+
+describe('SummaryArticle', function() {
+ describe('createChildLevel', function() {
+ it('must create the right level', function() {
+ var article = SummaryArticle.create({}, '1.1');
+ expect(article.createChildLevel()).toBe('1.1.1');
+ });
+
+ it('must create the right level when has articles', function() {
+ var article = SummaryArticle.create({
+ articles: [
+ {
+ title: 'Test'
+ }
+ ]
+ }, '1.1');
+ expect(article.createChildLevel()).toBe('1.1.2');
+ });
+ });
+});
+
+