-
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.
fix duplicated taskId, and add test to prevent it happening again
- Loading branch information
1 parent
b22ae5a
commit cba388c
Showing
5 changed files
with
71 additions
and
28 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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package tasks | ||
|
||
import org.specs2.matcher.FutureMatchers | ||
import org.specs2.mutable | ||
import utils.TestApp | ||
|
||
class TasksIdsSpec extends mutable.Specification with FutureMatchers { | ||
|
||
val (app, components) = TestApp.buildApp() | ||
|
||
"All scheduled tasks" should { | ||
"should not have duplicated taskId" in { | ||
val tasksids = components.allTasks.map(_.taskId) | ||
val duplicates = tasksids | ||
.groupBy(identity) | ||
.collect { | ||
case (value, occurrences) if occurrences.size > 1 => value | ||
} | ||
.toList | ||
duplicates shouldEqual Nil | ||
} | ||
|
||
"should not have duplicated taskNames" in { | ||
val taskNames = components.allTasks.map(_.taskName) | ||
val duplicates = taskNames | ||
.groupBy(identity) | ||
.collect { | ||
case (value, occurrences) if occurrences.size > 1 => value | ||
} | ||
.toList | ||
duplicates shouldEqual Nil | ||
} | ||
} | ||
} |