summaryrefslogtreecommitdiffstats
path: root/lib/models/__tests__/config.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-12-22 10:18:38 +0100
committerGitHub <noreply@github.com>2016-12-22 10:18:38 +0100
commit194ebc3da9641ff96f083f9d8ab43c2d27944f9a (patch)
treec50988f32ccf18df93ae7ab40be78e9459642818 /lib/models/__tests__/config.js
parent64ccb6b00b4b63fa0e516d4e35351275b34f8c07 (diff)
parent16af264360e48e8a833e9efa9ab8d194574dbc70 (diff)
downloadgitbook-194ebc3da9641ff96f083f9d8ab43c2d27944f9a.zip
gitbook-194ebc3da9641ff96f083f9d8ab43c2d27944f9a.tar.gz
gitbook-194ebc3da9641ff96f083f9d8ab43c2d27944f9a.tar.bz2
Merge pull request #1543 from GitbookIO/dream
React for rendering website with plugins
Diffstat (limited to 'lib/models/__tests__/config.js')
-rw-r--r--lib/models/__tests__/config.js90
1 files changed, 0 insertions, 90 deletions
diff --git a/lib/models/__tests__/config.js b/lib/models/__tests__/config.js
deleted file mode 100644
index abad754..0000000
--- a/lib/models/__tests__/config.js
+++ /dev/null
@@ -1,90 +0,0 @@
-var Immutable = require('immutable');
-var Config = require('../config');
-
-describe('Config', function() {
- var config = Config.createWithValues({
- hello: {
- world: 1,
- test: 'Hello',
- isFalse: false
- }
- });
-
- describe('getValue', function() {
- it('must return value as immutable', function() {
- var value = config.getValue('hello');
- expect(Immutable.Map.isMap(value)).toBeTruthy();
- });
-
- it('must return deep value', function() {
- var value = config.getValue('hello.world');
- expect(value).toBe(1);
- });
-
- it('must return default value if non existant', function() {
- var value = config.getValue('hello.nonExistant', 'defaultValue');
- expect(value).toBe('defaultValue');
- });
-
- it('must not return default value for falsy values', function() {
- var value = config.getValue('hello.isFalse', 'defaultValue');
- expect(value).toBe(false);
- });
- });
-
- describe('setValue', function() {
- it('must set value as immutable', function() {
- var testConfig = config.setValue('hello', {
- 'cool': 1
- });
- var value = testConfig.getValue('hello');
-
- expect(Immutable.Map.isMap(value)).toBeTruthy();
- expect(value.size).toBe(1);
- expect(value.has('cool')).toBeTruthy();
- });
-
- it('must set deep value', function() {
- var testConfig = config.setValue('hello.world', 2);
- var hello = testConfig.getValue('hello');
- var world = testConfig.getValue('hello.world');
-
- expect(Immutable.Map.isMap(hello)).toBeTruthy();
- expect(hello.size).toBe(3);
-
- 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'
- }
- });
- });
- });
-});
-
-