cartodb-4.42/lib/assets/test/spec/cartodb/public/authenticated_user.spec.js
2024-04-06 05:25:13 +00:00

20 lines
709 B
JavaScript

describe("Authenticated user", function() {
beforeEach(function() {
this.model = new cdb.open.AuthenticatedUser({});
});
it("should return the normal URL", function() {
var s = sinon.stub(this.model, '_getCurrentHost');
s.returns("test.carto.com");
expect(this.model.url()).toBe('//test.carto.com/api/v1/get_authenticated_users');
});
it("should return the a URL with a custom host", function() {
var s = sinon.stub(cdb.open.AuthenticatedUser.prototype, '_getCurrentHost');
s.returns("test.carto.com");
var model = new cdb.open.AuthenticatedUser({ host: "hello.carto.com" });
expect(model.url()).toBe('//hello.carto.com/api/v1/get_authenticated_users');
});
});