diff --git a/test/spec/connection.js b/test/spec/connection.js index 546a7c517..12a099f4c 100644 --- a/test/spec/connection.js +++ b/test/spec/connection.js @@ -3,19 +3,13 @@ describe('iD.Connection', function () { beforeEach(function () { context = iD(); - c = new iD.Connection(context); + c = new iD.Connection(context, {}); }); it('is instantiated', function () { expect(c).to.be.ok; }); - it('gets/sets url', function () { - var new_url = 'http://api06.openstreetmap.org'; - expect(c.url(new_url)).to.equal(c); - expect(c.url()).to.equal(new_url); - }); - it('gets/sets user', function () { var user = { name: 'tom' }; expect(c.user(user)).to.equal(c); @@ -40,6 +34,24 @@ describe('iD.Connection', function () { }); }); + describe("#switch", function() { + it("changes the URL", function() { + c.switch({ + url: "http://example.com" + }); + expect(c.changesetUrl(1)).to.equal("http://example.com/browse/changeset/1") + }); + + it("emits an auth event", function(done) { + c.on('auth', function() { + done(); + }); + c.switch({ + url: "http://example.com" + }); + }); + }); + describe('#loadFromURL', function () { it('loads test data', function (done) { c.loadFromURL('data/node.xml', done);