summaryrefslogtreecommitdiffstats
path: root/lib/models/__tests__
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-06-07 10:26:28 +0200
committerSamy Pessé <samypesse@gmail.com>2016-06-07 10:26:28 +0200
commit7178ab1f82616862edb3a53291aef155be66a4b7 (patch)
tree9a92d268eb3020cab29c68d257629beb6d1e2ac2 /lib/models/__tests__
parentbf895b707e6cc4ca5fdf4ade5bb9235f1b1b99ca (diff)
downloadgitbook-7178ab1f82616862edb3a53291aef155be66a4b7.zip
gitbook-7178ab1f82616862edb3a53291aef155be66a4b7.tar.gz
gitbook-7178ab1f82616862edb3a53291aef155be66a4b7.tar.bz2
Improve Config.toText to return only the required fields
Diffstat (limited to 'lib/models/__tests__')
-rw-r--r--lib/models/__tests__/config.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/models/__tests__/config.js b/lib/models/__tests__/config.js
index ff04ffd..abad754 100644
--- a/lib/models/__tests__/config.js
+++ b/lib/models/__tests__/config.js
@@ -55,6 +55,36 @@ describe('Config', function() {
expect(world).toBe(2);
});
});
+
+ describe('toReducedVersion', function() {
+ it('must only return diffs for simple values', function() {
+ var _config = Config.createWithValues({
+ gitbook: '3.0.0'
+ });
+
+ var reducedVersion = _config.toReducedVersion();
+
+ expect(reducedVersion.toJS()).toEqual({
+ gitbook: '3.0.0'
+ });
+ });
+
+ it('must only return diffs for deep values', function() {
+ var _config = Config.createWithValues({
+ structure: {
+ readme: 'intro.md'
+ }
+ });
+
+ var reducedVersion = _config.toReducedVersion();
+
+ expect(reducedVersion.toJS()).toEqual({
+ structure: {
+ readme: 'intro.md'
+ }
+ });
+ });
+ });
});