mirror of
https://github.com/atom/atom.git
synced 2026-02-13 08:04:56 -05:00
Add test to check for indexedDB connection
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -19,6 +19,10 @@ class StateStore {
|
||||
})
|
||||
}
|
||||
|
||||
connect () {
|
||||
return this.dbPromise.then(db => !!db)
|
||||
}
|
||||
|
||||
save (key, value) {
|
||||
return this.dbPromise.then(db => {
|
||||
if (!db) {
|
||||
|
||||
Reference in New Issue
Block a user