cmd: upgrade group
This commit is contained in:
@@ -5,11 +5,12 @@ import (
|
||||
"testing"
|
||||
|
||||
e "github.com/iliadenisov/galaxy/internal/error"
|
||||
"github.com/iliadenisov/galaxy/internal/model/game"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestJoinShipGroupToFleet(t *testing.T) {
|
||||
g := copyGame()
|
||||
g := newGame()
|
||||
var groupIndex uint = 1
|
||||
|
||||
assert.ErrorContains(t,
|
||||
@@ -85,11 +86,14 @@ func TestJoinShipGroupToFleet(t *testing.T) {
|
||||
// group not In_Orbit
|
||||
assert.NoError(t, g.CreateShips(Race_0_idx, Race_0_Gunship, R0_Planet_0_num, 7))
|
||||
gi = 3
|
||||
g.ShipGroups[gi].State = "In_Space"
|
||||
g.ShipGroups[gi].StateInSpace = &game.InSpace{
|
||||
Origin: 2,
|
||||
Range: 1,
|
||||
}
|
||||
assert.ErrorContains(t,
|
||||
g.JoinShipGroupToFleet(Race_0.Name, fleetOne, g.ShipGroups[gi].Index, 0),
|
||||
e.GenericErrorText(e.ErrShipsBusy))
|
||||
g.ShipGroups[gi].State = "In_Orbit"
|
||||
g.ShipGroups[gi].StateInSpace = nil
|
||||
|
||||
// existing fleet not on the same planet or in_orbit
|
||||
g.Fleets[0].Destination = R0_Planet_2_num
|
||||
@@ -100,7 +104,7 @@ func TestJoinShipGroupToFleet(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestJoinFleets(t *testing.T) {
|
||||
g := copyGame()
|
||||
g := newGame()
|
||||
// creating ShipGroup at Planet_0
|
||||
assert.NoError(t, g.CreateShips(Race_0_idx, Race_0_Freighter, R0_Planet_0_num, 1)) // group #1
|
||||
// creating ShipGroup at Planet_2
|
||||
|
||||
Reference in New Issue
Block a user