diff options
Diffstat (limited to 'spec/javascripts/graphs/stat_graph_contributors_graph_spec.js')
-rw-r--r-- | spec/javascripts/graphs/stat_graph_contributors_graph_spec.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js b/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js index 4a4d6969e86..7fd619b66a7 100644 --- a/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js +++ b/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js @@ -10,6 +10,7 @@ describe("ContributorsGraph", function () { describe("#set_x_domain", function () { it("set the x_domain", function () { ContributorsGraph.set_x_domain(20); + expect(ContributorsGraph.prototype.x_domain).toEqual(20); }); }); @@ -17,6 +18,7 @@ describe("ContributorsGraph", function () { describe("#set_y_domain", function () { it("sets the y_domain", function () { ContributorsGraph.set_y_domain([{ commits: 30 }]); + expect(ContributorsGraph.prototype.y_domain).toEqual([0, 30]); }); }); @@ -24,6 +26,7 @@ describe("ContributorsGraph", function () { describe("#init_x_domain", function () { it("sets the initial x_domain", function () { ContributorsGraph.init_x_domain([{ date: "2013-01-31" }, { date: "2012-01-31" }]); + expect(ContributorsGraph.prototype.x_domain).toEqual(["2012-01-31", "2013-01-31"]); }); }); @@ -31,6 +34,7 @@ describe("ContributorsGraph", function () { describe("#init_y_domain", function () { it("sets the initial y_domain", function () { ContributorsGraph.init_y_domain([{ commits: 30 }]); + expect(ContributorsGraph.prototype.y_domain).toEqual([0, 30]); }); }); @@ -40,6 +44,7 @@ describe("ContributorsGraph", function () { spyOn(ContributorsGraph, "init_x_domain"); spyOn(ContributorsGraph, "init_y_domain"); ContributorsGraph.init_domain(); + expect(ContributorsGraph.init_x_domain).toHaveBeenCalled(); expect(ContributorsGraph.init_y_domain).toHaveBeenCalled(); }); @@ -48,6 +53,7 @@ describe("ContributorsGraph", function () { describe("#set_dates", function () { it("sets the dates", function () { ContributorsGraph.set_dates("2013-12-01"); + expect(ContributorsGraph.prototype.dates).toEqual("2013-12-01"); }); }); @@ -59,6 +65,7 @@ describe("ContributorsGraph", function () { instance.x = d3.scaleTime().range([0, 100]).clamp(true); spyOn(instance.x, 'domain'); instance.set_x_domain(); + expect(instance.x.domain).toHaveBeenCalledWith(20); }); }); @@ -70,6 +77,7 @@ describe("ContributorsGraph", function () { instance.y = d3.scaleLinear().range([100, 0]).nice(); spyOn(instance.y, 'domain'); instance.set_y_domain(); + expect(instance.y.domain).toHaveBeenCalledWith(30); }); }); @@ -80,6 +88,7 @@ describe("ContributorsGraph", function () { spyOn(instance, 'set_x_domain'); spyOn(instance, 'set_y_domain'); instance.set_domain(); + expect(instance.set_x_domain).toHaveBeenCalled(); expect(instance.set_y_domain).toHaveBeenCalled(); }); @@ -89,6 +98,7 @@ describe("ContributorsGraph", function () { it("sets the data", function () { var instance = new ContributorsGraph(); instance.set_data("20"); + expect(instance.data).toEqual("20"); }); }); @@ -114,6 +124,7 @@ describe("ContributorsMasterGraph", function () { it("plucks the date field from data collection", function () { var graph = new ContributorsMasterGraph(); var data = [{ date: "2013-01-01" }, { date: "2012-12-15" }]; + expect(graph.get_dates(data)).toEqual(["2013-01-01", "2012-12-15"]); }); }); @@ -125,6 +136,7 @@ describe("ContributorsMasterGraph", function () { var data = [{ date: "2013-01-01" }, { date: "2012-12-15" }]; var correct = [{ date: parseDate(data[0].date) }, { date: parseDate(data[1].date) }]; graph.parse_dates(data); + expect(data).toEqual(correct); }); }); |