@@ -41,11 +41,49 @@ async fn test_without_chaining_documents() {
4141 . build ( ) ;
4242
4343 let rule = ChainRule :: NotSpecified ;
44- assert ! ( rule. check( & doc, & provider) . await . unwrap( ) ) ;
44+ let collaborators_rule = CollaboratorsRule :: NotSpecified ;
45+
46+ assert ! (
47+ rule. check( & doc, & provider, & collaborators_rule)
48+ . await
49+ . unwrap( )
50+ ) ;
4551 let rule = ChainRule :: Specified { optional : true } ;
46- assert ! ( rule. check( & doc, & provider) . await . unwrap( ) ) ;
52+ assert ! (
53+ rule. check( & doc, & provider, & collaborators_rule)
54+ . await
55+ . unwrap( )
56+ ) ;
4757 let rule = ChainRule :: Specified { optional : false } ;
48- assert ! ( !rule. check( & doc, & provider) . await . unwrap( ) ) ;
58+ assert ! (
59+ !rule
60+ . check( & doc, & provider, & collaborators_rule)
61+ . await
62+ . unwrap( )
63+ ) ;
64+ }
65+
66+ #[ tokio:: test]
67+ async fn chain_rule_collaborators_rule_conflict ( ) {
68+ let doc_type = UuidV4 :: new ( ) ;
69+ let doc_id = UuidV7 :: new ( ) ;
70+ let doc_ver = UuidV7 :: new ( ) ;
71+
72+ let provider = TestCatalystProvider :: default ( ) ;
73+ let doc = Builder :: new ( )
74+ . with_metadata_field ( SupportedField :: Type ( DocType :: from ( doc_type) ) )
75+ . with_metadata_field ( SupportedField :: Id ( doc_id) )
76+ . with_metadata_field ( SupportedField :: Ver ( doc_ver) )
77+ . build ( ) ;
78+
79+ let rule = ChainRule :: Specified { optional : true } ;
80+ let collaborators_rule = CollaboratorsRule :: Specified { optional : true } ;
81+ assert ! (
82+ !rule
83+ . check( & doc, & provider, & collaborators_rule)
84+ . await
85+ . unwrap( )
86+ ) ;
4987}
5088
5189#[ test_case(
@@ -131,8 +169,11 @@ async fn test_valid_chained_documents(
131169 ( provider, doc) : ( TestCatalystProvider , CatalystSignedDocument )
132170) -> bool {
133171 let rule = ChainRule :: Specified { optional : false } ;
172+ let collaborators_rule = CollaboratorsRule :: NotSpecified ;
134173
135- rule. check ( & doc, & provider) . await . unwrap ( )
174+ rule. check ( & doc, & provider, & collaborators_rule)
175+ . await
176+ . unwrap ( )
136177}
137178
138179#[ test_case(
@@ -278,6 +319,9 @@ async fn test_invalid_chained_documents(
278319 ( provider, doc) : ( TestCatalystProvider , CatalystSignedDocument )
279320) -> bool {
280321 let rule = ChainRule :: Specified { optional : false } ;
322+ let collaborators_rule = CollaboratorsRule :: NotSpecified ;
281323
282- rule. check ( & doc, & provider) . await . unwrap ( )
324+ rule. check ( & doc, & provider, & collaborators_rule)
325+ . await
326+ . unwrap ( )
283327}
0 commit comments