forked from se-sic/coronet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test 'get.data.cut.to.same.date' in presence of an empty data source
This test fails without the previous fix by Thomas Bock but does not fail when the fix is in place. This works towards fixing se-sic#269. Signed-off-by: Maximilian Löffler <[email protected]>
- Loading branch information
1 parent
2fc6bdc
commit 079b811
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
## Copyright 2018 by Thomas Bock <[email protected]> | ||
## Copyright 2020 by Thomas Bock <[email protected]> | ||
## Copyright 2018 by Jakob Kronawitter <[email protected]> | ||
## Copyright 2024 by Maximilian Löffler <[email protected]> | ||
## All Rights Reserved. | ||
|
||
|
||
|
@@ -82,3 +83,58 @@ test_that("Cut commit and mail data to same date range.", { | |
expect_identical(mail.data, mail.data.expected, info = "Cut mail data.") | ||
|
||
}) | ||
|
||
test_that("Cut data to same date range with one empty data source.", { | ||
|
||
## configurations | ||
|
||
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT) | ||
proj.conf$update.value("issues.locked", TRUE) | ||
data.sources = c("issues", "mails", "commits") | ||
|
||
## construct objects | ||
|
||
x.data = ProjectData$new(proj.conf) | ||
x.data$set.issues(NULL) | ||
|
||
commit.data.expected = data.frame(commit.id = sprintf("<commit-%s>", c(32712, 32713)), | ||
date = get.date.from.string(c("2016-07-12 15:58:59", "2016-07-12 16:00:45")), | ||
author.name = c("Björn", "Olaf"), | ||
author.email = c("[email protected]", "[email protected]"), | ||
committer.date = get.date.from.string(c("2016-07-12 15:58:59", "2016-07-20 10:00:44")), | ||
committer.name = c("Björn", "Björn"), | ||
committer.email = c("[email protected]", "[email protected]"), | ||
hash = c("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "5a5ec9675e98187e1e92561e1888aa6f04faa338"), | ||
changed.files = as.integer(c(1, 1)), | ||
added.lines = as.integer(c(1, 1)), | ||
deleted.lines = as.integer(c(1, 0)), | ||
diff.size = as.integer(c(2, 1)), | ||
file = c("test.c", "test.c"), | ||
artifact = c("A", "A"), | ||
artifact.type = c("Feature", "Feature"), | ||
artifact.diff.size = as.integer(c(1, 1))) | ||
|
||
mail.data.expected = data.frame(author.name = c("Thomas", "Olaf"), | ||
author.email = c("[email protected]", "[email protected]"), | ||
message.id = c("<[email protected]>", "<[email protected]>"), | ||
date = get.date.from.string(c("2016-07-12 16:04:40", "2016-07-12 16:05:37")), | ||
date.offset = as.integer(c(100, 200)), | ||
subject = c("Re: Fw: busybox 2 tab", "Re: Fw: busybox 10"), | ||
thread = sprintf("<thread-%s>", c("13#9", "13#9")), | ||
artifact.type = c("Mail", "Mail")) | ||
|
||
issue.data.expected = create.empty.issues.list() | ||
|
||
commit.data = x.data$get.data.cut.to.same.date(data.sources = data.sources)$get.commits.unfiltered() | ||
rownames(commit.data) = 1:nrow(commit.data) | ||
|
||
mail.data = x.data$get.data.cut.to.same.date(data.sources = data.sources)$get.mails() | ||
rownames(mail.data) = 1:nrow(mail.data) | ||
|
||
issue.data = x.data$get.data.cut.to.same.date(data.sources = data.sources)$get.issues() | ||
|
||
expect_identical(commit.data, commit.data.expected, info = "Cut Raw commit data.") | ||
expect_identical(mail.data, mail.data.expected, info = "Cut mail data.") | ||
expect_identical(issue.data, issue.data.expected, info = "Cut issue data.") | ||
|
||
}) |