Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohann Hubert Sonntagbauer <johann.sonntagbauer@gmail.com>2018-10-09 21:03:09 +0300
committerJohann Hubert Sonntagbauer <johann.sonntagbauer@gmail.com>2018-10-17 07:57:29 +0300
commit6f5723a169b5d400c136dbd844fc54c68e5f8563 (patch)
treee7bad2648366ed5943293655a0abe23367e869a6 /spec/javascripts/graphs
parent28d412e5b2b8499fba22e8fabb1d44f44449228e (diff)
enable jasmine/new-line-before-expect
Diffstat (limited to 'spec/javascripts/graphs')
-rw-r--r--spec/javascripts/graphs/stat_graph_contributors_graph_spec.js12
-rw-r--r--spec/javascripts/graphs/stat_graph_contributors_util_spec.js14
2 files changed, 26 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);
});
});
diff --git a/spec/javascripts/graphs/stat_graph_contributors_util_spec.js b/spec/javascripts/graphs/stat_graph_contributors_util_spec.js
index 8854d3d554a..a4f3e94db6b 100644
--- a/spec/javascripts/graphs/stat_graph_contributors_util_spec.js
+++ b/spec/javascripts/graphs/stat_graph_contributors_util_spec.js
@@ -28,6 +28,7 @@ describe("ContributorsStatGraphUtil", function () {
}
]
};
+
expect(ContributorsStatGraphUtil.parse_log(fake_log)).toEqual(correct_parsed_log);
});
});
@@ -40,18 +41,21 @@ describe("ContributorsStatGraphUtil", function () {
it("calls #store_commits", function () {
spyOn(ContributorsStatGraphUtil, 'store_commits');
ContributorsStatGraphUtil.store_data(fake_entry, fake_total, fake_by_author);
+
expect(ContributorsStatGraphUtil.store_commits).toHaveBeenCalled();
});
it("calls #store_additions", function () {
spyOn(ContributorsStatGraphUtil, 'store_additions');
ContributorsStatGraphUtil.store_data(fake_entry, fake_total, fake_by_author);
+
expect(ContributorsStatGraphUtil.store_additions).toHaveBeenCalled();
});
it("calls #store_deletions", function () {
spyOn(ContributorsStatGraphUtil, 'store_deletions');
ContributorsStatGraphUtil.store_data(fake_entry, fake_total, fake_by_author);
+
expect(ContributorsStatGraphUtil.store_deletions).toHaveBeenCalled();
});
});
@@ -72,12 +76,14 @@ describe("ContributorsStatGraphUtil", function () {
it("adds 1 to current test_field in collection", function () {
var fake_collection = { test_field: 10 };
ContributorsStatGraphUtil.add(fake_collection, "test_field", 1);
+
expect(fake_collection.test_field).toEqual(11);
});
it("inits and adds 1 if test_field in collection is not defined", function () {
var fake_collection = {};
ContributorsStatGraphUtil.add(fake_collection, "test_field", 1);
+
expect(fake_collection.test_field).toEqual(1);
});
});
@@ -111,6 +117,7 @@ describe("ContributorsStatGraphUtil", function () {
var fake_date = "2013-10-02";
var fake_collection = {};
ContributorsStatGraphUtil.add_date(fake_date, fake_collection);
+
expect(fake_collection[fake_date].date).toEqual("2013-10-02");
});
});
@@ -121,6 +128,7 @@ describe("ContributorsStatGraphUtil", function () {
var fake_author_collection = {};
var fake_email_collection = {};
ContributorsStatGraphUtil.add_author(fake_author, fake_author_collection, fake_email_collection);
+
expect(fake_author_collection[fake_author.author_name].author_name).toEqual("Author");
expect(fake_email_collection[fake_author.author_email].author_name).toEqual("Author");
});
@@ -148,6 +156,7 @@ describe("ContributorsStatGraphUtil", function () {
{ date: "2013-05-08", commits: 3 },
{ date: "2013-05-09", commits: 1 }
];
+
expect(ContributorsStatGraphUtil.get_total_data(fake_parsed_log, "commits")).toEqual(correct_total_data);
});
});
@@ -160,6 +169,7 @@ describe("ContributorsStatGraphUtil", function () {
];
ContributorsStatGraphUtil.pick_field(fake_parsed_log_total, "commits");
var correct_pick_field_data = [{ date: "2013-05-09", commits: 1 }, { date: "2013-05-08", commits: 3 }];
+
expect(ContributorsStatGraphUtil.pick_field(fake_parsed_log_total, "commits")).toEqual(correct_pick_field_data);
});
});
@@ -186,6 +196,7 @@ describe("ContributorsStatGraphUtil", function () {
{ author_name: "Dmitriy Zaporozhets", author_email: "dzaporozhets@email.com", dates: { "2013-05-08": 3 }, deletions: 7, additions: 54, "commits": 3 },
{ author_name: "Karlo Soriano", author_email: "karlo@email.com", dates: { "2013-05-09": 1 }, deletions: 0, additions: 471, commits: 1 }
];
+
expect(ContributorsStatGraphUtil.get_author_data(fake_parsed_log, "commits")).toEqual(correct_author_data);
});
});
@@ -196,6 +207,7 @@ describe("ContributorsStatGraphUtil", function () {
"2013-05-09": { date: "2013-05-09", additions: 471, deletions: 0, commits: 1 }
};
var correct_parsed_log = { author_name: "Karlo Soriano", author_email: "karlo@email.com", dates: { "2013-05-09": 1 }, deletions: 0, additions: 471, commits: 1 };
+
expect(ContributorsStatGraphUtil.parse_log_entry(fake_log_entry, 'commits', null)).toEqual(correct_parsed_log);
});
});
@@ -208,11 +220,13 @@ describe("ContributorsStatGraphUtil", function () {
it("returns true if date is in range", function () {
var date_range = [new Date("2013-01-01"), new Date("2013-12-12")];
+
expect(ContributorsStatGraphUtil.in_range(date, date_range)).toEqual(true);
});
it("returns false if date is not in range", function () {
var date_range = [new Date("1999-12-01"), new Date("2000-12-01")];
+
expect(ContributorsStatGraphUtil.in_range(date, date_range)).toEqual(false);
});
});