-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jan Krems
committed
Sep 11, 2018
1 parent
43dec33
commit ebf18c1
Showing
5 changed files
with
89 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
'use strict' | ||
|
||
path = require 'path' | ||
os = require 'os' | ||
fs = require 'fs' | ||
|
||
assert = require 'assertive' | ||
{Observable} = require 'rx' | ||
tmp = require 'tmp' | ||
|
||
SharedStore = require '../../' | ||
|
||
BASE_CONFIG = opt: 'value' | ||
|
||
describe 'With cache disabled', -> | ||
before (done) -> | ||
tmp.dir { unsafeCleanup: true }, (err, @tmpDir) => done(err) | ||
return | ||
|
||
describe 'with cache disabled', -> | ||
before (done) -> | ||
@overrideFile = | ||
path.join os.tmpdir(), 'shared-store.test.json' | ||
@initialOverrides = override: 'loaded' | ||
|
||
fs.writeFile( | ||
@overrideFile, JSON.stringify(@initialOverrides), done | ||
) | ||
return | ||
|
||
before (done) -> | ||
@store = new SharedStore { | ||
temp: @tmpDir | ||
active: true | ||
loader: (baseConfig) => | ||
assert.deepEqual BASE_CONFIG, baseConfig | ||
Observable.just(data: { static: 'data' }, source: 'static') | ||
} | ||
@store.setActive writeCacheFiles: false | ||
@store.init opt: 'value', (err, @initCallbackData) => done(err) | ||
return | ||
|
||
it 'returns the initial data', -> | ||
assert.deepEqual { | ||
static: 'data' | ||
}, @store.getCurrent() | ||
|
||
it 'writes no cache file', -> | ||
cacheFiles = fs.readdirSync @tmpDir | ||
assert.equal 0, cacheFiles.length |