climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1494248 - /incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/RcmedSelectionCtrlTest.js
Date Tue, 18 Jun 2013 18:50:09 GMT
Author: joyce
Date: Tue Jun 18 18:50:09 2013
New Revision: 1494248

URL: http://svn.apache.org/r1494248
Log:
CLIMATE-123 progress - Add RcmedSelectionCtrl initialization test.

Added:
    incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/RcmedSelectionCtrlTest.js

Added: incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/RcmedSelectionCtrlTest.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/RcmedSelectionCtrlTest.js?rev=1494248&view=auto
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/RcmedSelectionCtrlTest.js
(added)
+++ incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/RcmedSelectionCtrlTest.js
Tue Jun 18 18:50:09 2013
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http: *www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+**/
+
+'use strict';
+
+describe('OCW Controllers', function() {
+
+	beforeEach(module('ocw.controllers'));
+	beforeEach(module('ocw.services'));
+
+	describe('RcmedSelectionCtrl', function() {
+		it('should automatically query RCMED on initialization', function() {
+			inject(function($rootScope, $controller, $httpBackend) {
+				$rootScope.baseURL = "http://localhost:8082"
+				$httpBackend.expectJSONP($rootScope.baseURL + '/getObsDatasets?callback=JSON_CALLBACK').
+					respond(200, [{longname: 1}, {longname: 2}]);
+
+				var scope = $rootScope.$new();
+				var ctrl = $controller("RcmedSelectionCtrl", {$scope: scope});
+				$httpBackend.flush();
+
+				expect(scope.availableObs.length).toBe(3);
+				expect(scope.availableObs[0]).toEqual({longname: "Please select an option"});
+				expect(scope.availableObs[1]).toEqual({longname: 1});
+			});
+		});
+	});
+});



Mime
View raw message