diff --git a/spec/auto-update-manager-spec.coffee b/spec/auto-update-manager-spec.coffee index 2c459c745..4fde97c31 100644 --- a/spec/auto-update-manager-spec.coffee +++ b/spec/auto-update-manager-spec.coffee @@ -6,6 +6,10 @@ describe "AutoUpdateManager", -> @nylasIdentityId = null @accounts = [{email_address: 'ben@nylas.com'},{email_address: 'mark@nylas.com'}] @specMode = true + @databaseReader = + getJSONBlob: => { + id: @nylasIdentityId + } @config = set: jasmine.createSpy('config.set') get: (key) => @@ -18,7 +22,7 @@ describe "AutoUpdateManager", -> describe "with attached commit version", -> it "correctly sets the feedURL", -> - m = new AutoUpdateManager("3.222.1-abc", @config, @specMode) + m = new AutoUpdateManager("3.222.1-abc", @config, @specMode, @databaseReader) spyOn(m, "setupAutoUpdater") {query} = url.parse(m.feedURL, true) @@ -28,7 +32,7 @@ describe "AutoUpdateManager", -> describe "with no attached commit", -> it "correctly sets the feedURL", -> - m = new AutoUpdateManager("3.222.1", @config, @specMode) + m = new AutoUpdateManager("3.222.1", @config, @specMode, @databaseReader) spyOn(m, "setupAutoUpdater") {query} = url.parse(m.feedURL, true) expect(query.arch).toBe process.arch @@ -37,7 +41,7 @@ describe "AutoUpdateManager", -> describe "when an update identity is not present", -> it "should use anonymous", -> - m = new AutoUpdateManager("3.222.1", @config, @specMode) + m = new AutoUpdateManager("3.222.1", @config, @specMode, @databaseReader) spyOn(m, "setupAutoUpdater") {query} = url.parse(m.feedURL, true) expect(query.id).toEqual('anonymous') @@ -45,18 +49,18 @@ describe "AutoUpdateManager", -> describe "when an update identity is already set", -> it "should send it and not save any changes", -> @nylasIdentityId = "test-nylas-id" - m = new AutoUpdateManager("3.222.1", @config, @specMode) + m = new AutoUpdateManager("3.222.1", @config, @specMode, @databaseReader) spyOn(m, "setupAutoUpdater") {query} = url.parse(m.feedURL, true) expect(query.id).toEqual(@nylasIdentityId) describe "when an update identity is added", -> it "should update the feed URL", -> - m = new AutoUpdateManager("3.222.1", @config, @specMode) + m = new AutoUpdateManager("3.222.1", @config, @specMode, @databaseReader) spyOn(m, "setupAutoUpdater") {query} = url.parse(m.feedURL, true) expect(query.id).toEqual('anonymous') @nylasIdentityId = '1' - m._updateFeedURL() + m.updateFeedURL() {query} = url.parse(m.feedURL, true) expect(query.id).toEqual(@nylasIdentityId)