1 describe("clusterConnect", function() {
3 var ClusterConnect = window.app.ui.ClusterConnect;
5 describe("when created", function() {
7 var prefs, success_callback, cluster, clusterConnect;
9 beforeEach( function() {
11 set: jasmine.createSpy("set")
13 spyOn( window.app.services.Preferences, "instance" ).and.callFake( function() {
17 get: jasmine.createSpy("get").and.callFake( function(uri, success) {
18 success_callback = success;
21 clusterConnect = new ClusterConnect({
22 base_uri: "http://localhost:9200",
27 it("should test the connection to the cluster", function() {
28 expect( cluster.get ).toHaveBeenCalled();
31 it("should store successful connection in preferences", function() {
32 success_callback("fakePayload");
33 expect( prefs.set ).toHaveBeenCalled();