-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d60ebb8
commit 6650512
Showing
4 changed files
with
101 additions
and
2 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
87 changes: 87 additions & 0 deletions
87
housekeeping/src/test/groovy/whelk/housekeeping/NotificationRulesSpec.groovy
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,87 @@ | ||
package whelk.housekeeping | ||
|
||
import spock.lang.Specification | ||
import whelk.Document | ||
|
||
class NotificationRulesSpec extends Specification { | ||
|
||
def "Change PrimaryContribution familyName"() { | ||
given: | ||
Document framedBefore = new Document([ | ||
"mainEntity" : [ | ||
"instanceOf" : [ | ||
"contribution" : [ | ||
[ | ||
"@type" : "PrimaryContribution", | ||
"agent" : [ | ||
"familyName": "aaa", | ||
"givenName": "bbb", | ||
"lifeSpan": "2022-2023" | ||
] | ||
] | ||
] | ||
] | ||
] | ||
]) | ||
Document framedAfter = new Document([ | ||
"mainEntity" : [ | ||
"instanceOf" : [ | ||
"contribution" : [ | ||
[ | ||
"@type" : "PrimaryContribution", | ||
"agent" : [ | ||
"familyName": "aab", | ||
"givenName": "bbb", | ||
"lifeSpan": "2022-2023" | ||
] | ||
] | ||
] | ||
] | ||
] | ||
]) | ||
Tuple result = NotificationRules.primaryContributionChanged(framedBefore, framedAfter) | ||
|
||
expect: | ||
result[0] == true | ||
} | ||
|
||
def "Change PrimaryContribution givenName"() { | ||
given: | ||
Document framedBefore = new Document([ | ||
"mainEntity" : [ | ||
"instanceOf" : [ | ||
"contribution" : [ | ||
[ | ||
"@type" : "PrimaryContribution", | ||
"agent" : [ | ||
"familyName": "aaa", | ||
"givenName": "bbb", | ||
"lifeSpan": "2022-2023" | ||
] | ||
] | ||
] | ||
] | ||
] | ||
]) | ||
Document framedAfter = new Document([ | ||
"mainEntity" : [ | ||
"instanceOf" : [ | ||
"contribution" : [ | ||
[ | ||
"@type" : "PrimaryContribution", | ||
"agent" : [ | ||
"familyName": "aaa", | ||
"givenName": "bbc", | ||
"lifeSpan": "2022-2023" | ||
] | ||
] | ||
] | ||
] | ||
] | ||
]) | ||
Tuple result = NotificationRules.primaryContributionChanged(framedBefore, framedAfter) | ||
|
||
expect: | ||
result[0] == true | ||
} | ||
} |