Add test to check for indexedDB connection

This commit is contained in:
Katrina Uychaco
2016-02-10 11:04:30 -08:00
parent fa70560eba
commit 7b808257a6
2 changed files with 11 additions and 0 deletions

View File

@@ -152,6 +152,8 @@ describe "AtomEnvironment", ->
atom.enablePersistence = false
it "selects the state based on the current project paths", ->
jasmine.useRealClock()
[dir1, dir2] = [temp.mkdirSync("dir1-"), temp.mkdirSync("dir2-")]
loadSettings = _.extend atom.getLoadSettings(),
@@ -163,6 +165,11 @@ describe "AtomEnvironment", ->
spyOn(atom, 'deserialize')
atom.project.setPaths([dir1, dir2])
# State persistence will fail if other Atom instances are running
waitsForPromise ->
atom.stateStore.connect().then (isConnected) ->
expect(isConnected).toBe true
waitsForPromise ->
atom.saveState().then ->
atom.loadState()

View File

@@ -19,6 +19,10 @@ class StateStore {
})
}
connect () {
return this.dbPromise.then(db => !!db)
}
save (key, value) {
return this.dbPromise.then(db => {
if (!db) {