@@ -152,7 +152,10 @@ testHistoryConflict = do
152152 -- adding an empty commit to be able to test application message rejection
153153 void $ createPendingProposalCommit convId alice1 >>= sendAndConsumeCommitBundle
154154
155- -- HISTORY ENABLED
155+ -- a history client cannot be added if shared history is disabled
156+ assertAddHistoryClientRejected convId alice1
157+
158+ -- SHARED HISTORY ENABLED
156159 enableHistorySharing convId alice
157160
158161 -- application message and add commit are rejected
@@ -165,24 +168,45 @@ testHistoryConflict = do
165168 void $ sendAndConsumeCommitBundle mp
166169 pure hid
167170
171+ -- it is not possible to add more than 1 history client
172+ assertAddHistoryClientRejected convId alice1
173+
168174 -- application message and add commits are accepted
169175 void $ createApplicationMessage convId alice1 " hello" >>= sendAndConsumeMessage
170176 void $ createAddCommit alice1 convId [charlie] >>= sendAndConsumeCommitBundle
171177
172- -- HISTORY DISABLED
178+ -- SHARED HISTORY DISABLED
173179 disableHistorySharing convId alice
174180
175- -- application message and add commit are rejected
181+ -- application message and add commit, as well as history client requests are rejected
176182 assertApplicationMessageFailure convId alice1
177183 assertAddCommitIsRejected convId alice1 [dorothy]
184+ assertAddHistoryClientRejected convId alice1
178185
179186 -- HISTORY CLIENT REMOVED
180187 void $ createRemoveCommit' alice1 convId [HistoryClient hid] >>= sendAndConsumeCommitBundle
181188
182189 -- application message and add commits are accepted
183190 void $ createApplicationMessage convId alice1 " hello" >>= sendAndConsumeMessage
184191 void $ createAddCommit alice1 convId [emily] >>= sendAndConsumeCommitBundle
192+
193+ -- a history client cannot be added if shared history is disabled
194+ assertAddHistoryClientRejected convId alice1
185195 where
196+ assertAddHistoryClientRejected :: (HasCallStack ) => ConvId -> ClientIdentity -> App ()
197+ assertAddHistoryClientRejected convId user = do
198+ mp <- fst <$> createAddCommitWithHistoryClient user convId []
199+ postMLSCommitBundle mp. sender (mkBundle mp) `bindResponse` \ resp -> do
200+ resp. status `shouldMatchInt` 400
201+ resp. json %. " label" `shouldMatch` " mls-history-client-conflict"
202+
203+ -- assertAddHistoryClientFailure :: (HasCallStack) => ConvId -> ClientIdentity -> App ()
204+ -- assertAddHistoryClientFailure convId user = do
205+ -- mp <- fst <$> createAddCommitWithHistoryClient user convId []
206+ -- postMLSCommitBundle mp.sender (mkBundle mp) `bindResponse` \resp -> do
207+ -- resp.status `shouldMatchInt` 400
208+ -- resp.json %. "label" `shouldMatch` "mls-history-client-conflict"
209+
186210 assertAddCommitIsRejected :: (HasCallStack ) => ConvId -> ClientIdentity -> [Value ] -> App ()
187211 assertAddCommitIsRejected convId user users =
188212 withMLSStateReset $ do
0 commit comments