Skip to content

Commit

Permalink
test: Initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-sirotin committed Jul 9, 2024
1 parent 8914792 commit 41162f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pkg/game/game.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,10 @@ func (g *Game) CreateNewRoom() (*protocol.Room, *protocol.State, error) {
}

func (g *Game) JoinRoom(roomID protocol.RoomID, state *protocol.State) error {
if !g.initialized {
return errors.New("game is not initialized")
}

if g.RoomID() == roomID {
return errors.New("already in this room")
}
Expand Down
5 changes: 4 additions & 1 deletion pkg/game/game_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ func (s *Suite) SetupTest() {
WithEnableSymmetricEncryption(true),
})

s.Require().False(s.dealer.Initialized())

err := s.dealer.Initialize()
s.Require().NoError(err)
s.Require().True(s.dealer.Initialized())
}

func (s *Suite) TearDownTest() {
Expand Down Expand Up @@ -395,7 +398,7 @@ func (s *Suite) TestOnlineState() {
WithEnablePublishOnlineState(false), // FIXME: Add a separate test for self publishing
})

s.Logger.Debug("test info",
s.Logger.Debug("xtest info",
zap.Any("player", player),
zap.Any("dealer", s.dealer.Player()),
)
Expand Down

0 comments on commit 41162f5

Please sign in to comment.