Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioPinheiro committed Jul 13, 2023
1 parent 1511ffe commit 58623d9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ case class MediatorAgent(
Option[EncryptedMessage]
] =
ZIO
.logAnnotate("msgHash", msg.hashCode.toString) {
.logAnnotate("msgHash", msg.sha1) {
for {
_ <- ZIO.log("receivedMessage")
maybeSyncReplyMsg <-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ object PickupExecuter
from = m.to.asFROM,
to = m.from.asTO,
recipient_did = m.recipient_did,
attachments = messagesToReturn.map(m => (m.hashCode.toString, m.msg)).toMap,
attachments = messagesToReturn.map(m => (m._id, m.msg)).toMap,
)
} yield SyncReplyOnly(deliveryRequest.toPlaintextMessage)
case m: MessageDelivery =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ object MessageItemRepoSpec extends ZIOSpecDefault with AccountStubSetup {
for {
messageItem <- ZIO.service[MessageItemRepo]
msg <- ZIO.fromEither(encryptedMessageAlice)
result <- messageItem.findById(msg.hashCode())
result <- messageItem.findById(msg.sha1)
} yield {
assertTrue(result.contains(MessageItem(msg)))
}
Expand All @@ -39,7 +39,7 @@ object MessageItemRepoSpec extends ZIOSpecDefault with AccountStubSetup {
msg <- ZIO.fromEither(encryptedMessageAlice)
msg2 <- ZIO.fromEither(encryptedMessageBob)
msg2Added <- messageItem.insert(MessageItem(msg2))
result <- messageItem.findByIds(Seq(msg.hashCode(), msg2.hashCode()))
result <- messageItem.findByIds(Seq(msg.sha1, msg2.sha1))
} yield {
assertTrue(result.contains(MessageItem(msg)))
assertTrue(result.contains(MessageItem(msg2)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ object UserAccountRepoSpec extends ZIOSpecDefault with AccountStubSetup {
val messageMetaData: Seq[MessageMetaData] = didAccount.map(_.messagesRef).getOrElse(Seq.empty)
assert(messageMetaData)(
forall(
hasField("hash", (m: MessageMetaData) => m.hash, equalTo(msg.hashCode()))
hasField("hash", (m: MessageMetaData) => m.hash, equalTo(msg.sha1))
&& hasField("recipient", (m: MessageMetaData) => m.recipient, equalTo(DIDSubject(bob)))
)
)
Expand All @@ -141,7 +141,7 @@ object UserAccountRepoSpec extends ZIOSpecDefault with AccountStubSetup {
for {
userAccount <- ZIO.service[UserAccountRepo]
msg <- ZIO.fromEither(encryptedMessageAlice)
markedDelivered <- userAccount.markAsDelivered(DIDSubject(alice), Seq(msg.hashCode()))
markedDelivered <- userAccount.markAsDelivered(DIDSubject(alice), Seq(msg.sha1))
didAccount <- userAccount.getDidAccount(DIDSubject(alice))
} yield {
assertTrue(markedDelivered == 1)
Expand Down

0 comments on commit 58623d9

Please sign in to comment.