-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
6 changed files
with
51 additions
and
5 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
18 changes: 17 additions & 1 deletion
18
src/test/scala/com/fluency03/blockchain/api/actors/NetworkActorTest.scala
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 |
---|---|---|
@@ -1,5 +1,21 @@ | ||
package com.fluency03.blockchain.api.actors | ||
|
||
class NetworkActorTest { | ||
import akka.actor.{ActorRef, ActorSystem, Props} | ||
import akka.testkit.{ImplicitSender, TestKit} | ||
import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpecLike} | ||
|
||
class NetworkActorTest extends TestKit(ActorSystem("NetworkActorTest")) with ImplicitSender | ||
with WordSpecLike with Matchers with BeforeAndAfterAll { | ||
|
||
override def afterAll: Unit = { | ||
shutdown() | ||
} | ||
|
||
val networkActor: ActorRef = system.actorOf(Props[NetworkActor]) | ||
|
||
|
||
|
||
|
||
|
||
|
||
} |
27 changes: 26 additions & 1 deletion
27
src/test/scala/com/fluency03/blockchain/api/actors/PeerActorTest.scala
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 |
---|---|---|
@@ -1,5 +1,30 @@ | ||
package com.fluency03.blockchain.api.actors | ||
|
||
class PeerActorTest { | ||
import akka.actor.{ActorRef, ActorSystem, Props} | ||
import akka.testkit.{ImplicitSender, TestKit} | ||
import com.fluency03.blockchain.api.actors.PeerActor.GetPublicKeys | ||
import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpecLike} | ||
|
||
class PeerActorTest extends TestKit(ActorSystem("PeerActorTest")) with ImplicitSender | ||
with WordSpecLike with Matchers with BeforeAndAfterAll { | ||
|
||
override def afterAll: Unit = { | ||
shutdown() | ||
} | ||
|
||
val peerActor: ActorRef = system.actorOf(Props[PeerActor]) | ||
|
||
"A BlocksActor" should { | ||
"Respond with a Seq of Blocks." in { | ||
PeerActor.props shouldEqual Props[PeerActor] | ||
|
||
peerActor ! GetPublicKeys | ||
val publicKeys = expectMsgType[Set[String]] | ||
publicKeys.size shouldEqual 1 | ||
|
||
peerActor ! "other" | ||
expectNoMessage | ||
} | ||
} | ||
|
||
} |
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