You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by jo...@apache.org on 2014/08/05 19:32:12 UTC

[14/19] git commit: Transition selectdatasetinformation service tests

Transition selectdatasetinformation service tests


Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/c1691570
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/c1691570
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/c1691570

Branch: refs/heads/master
Commit: c1691570ef1de65ae375479de5c9454043d8414a
Parents: 459154f
Author: Michael Joyce <jo...@apache.org>
Authored: Fri Aug 1 13:53:11 2014 -0700
Committer: Michael Joyce <jo...@apache.org>
Committed: Mon Aug 4 15:01:02 2014 -0700

----------------------------------------------------------------------
 .../spec/services/selecteddatasetinformation.js | 59 +++++++++++++++++++-
 1 file changed, 57 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/c1691570/ocw-ui/frontend-new/test/spec/services/selecteddatasetinformation.js
----------------------------------------------------------------------
diff --git a/ocw-ui/frontend-new/test/spec/services/selecteddatasetinformation.js b/ocw-ui/frontend-new/test/spec/services/selecteddatasetinformation.js
index 75000e9..60c1ac2 100644
--- a/ocw-ui/frontend-new/test/spec/services/selecteddatasetinformation.js
+++ b/ocw-ui/frontend-new/test/spec/services/selecteddatasetinformation.js
@@ -30,8 +30,63 @@ describe('Service: selectedDatasetInformation', function () {
     selectedDatasetInformation = _selectedDatasetInformation_;
   }));
 
-  it('should do something', function () {
-    expect(!!selectedDatasetInformation).toBe(true);
+  it('should initialize the selectedDatasetInformation service', function() {
+    inject(function(selectedDatasetInformation) {
+      expect(selectedDatasetInformation).not.toEqual(null);
+    });
   });
 
+  it('should provide the getDatasets function', function() {
+    inject(function(selectedDatasetInformation) {
+      expect(selectedDatasetInformation.getDatasets()).not.toEqual(null);
+    });
+  });
+
+  it('should provide the getDatasetCount function', function() {
+    inject(function(selectedDatasetInformation) {
+      expect(selectedDatasetInformation.getDatasetCount()).toEqual(0);
+    });
+  });
+
+  it('should provide the addDataset function', function() {
+    inject(function(selectedDatasetInformation) {
+      selectedDatasetInformation.addDataset({});
+      expect(selectedDatasetInformation.getDatasetCount()).toEqual(1);
+    });
+  });
+
+  it('should set the shouldDisplay attribute when adding a dataset', function() {
+    inject(function(selectedDatasetInformation) {
+      selectedDatasetInformation.addDataset({});
+      expect(selectedDatasetInformation.getDatasets()[0].shouldDisplay).toBe(false);
+    });
+  });
+
+  it('should set the regrid attribute when adding a dataset', function() {
+    inject(function(selectedDatasetInformation) {
+      selectedDatasetInformation.addDataset({});
+      expect(selectedDatasetInformation.getDatasets()[0].regrid).toBe(false);
+    });
+  });
+
+  it('should provide the removeDataset function', function() {
+    inject(function(selectedDatasetInformation) {
+      selectedDatasetInformation.addDataset(1);
+      selectedDatasetInformation.addDataset(2);
+
+      expect(selectedDatasetInformation.getDatasets()[0]).toEqual(1);
+      selectedDatasetInformation.removeDataset(0);
+      expect(selectedDatasetInformation.getDatasets()[0]).toEqual(2);
+    });
+  });
+
+  it('should provide the clearDatasets function', function() {
+    inject(function(selectedDatasetInformation) {
+      selectedDatasetInformation.addDataset({});
+      expect(selectedDatasetInformation.getDatasetCount()).toEqual(1);
+
+      selectedDatasetInformation.clearDatasets();
+      expect(selectedDatasetInformation.getDatasetCount()).toEqual(0);
+    });
+  });
 });