Fix tests

This commit is contained in:
John Firebaugh
2013-04-17 16:57:46 -07:00
parent 001078876f
commit f4d9ec23c7

View File

@@ -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);