refactoring: changed name on compare command to make properties more explainatory

This commit is contained in:
Torkel Ödegaard
2017-06-05 23:29:25 +02:00
parent 9c1401849e
commit 746d6cdc88
4 changed files with 32 additions and 29 deletions

View File

@@ -30,17 +30,17 @@ func init() {
// CompareDashboardVersionsCommand computes the JSON diff of two versions,
// assigning the delta of the diff to the `Delta` field.
func CompareDashboardVersionsCommand(cmd *m.CompareDashboardVersionsCommand) error {
original, err := getDashboardVersion(cmd.DashboardId, cmd.Original)
baseVersion, err := getDashboardVersion(cmd.DashboardId, cmd.BaseVersion)
if err != nil {
return err
}
newDashboard, err := getDashboardVersion(cmd.DashboardId, cmd.New)
newVersion, err := getDashboardVersion(cmd.DashboardId, cmd.NewVersion)
if err != nil {
return err
}
left, jsonDiff, err := getDiff(original, newDashboard)
left, jsonDiff, err := getDiff(baseVersion, newVersion)
if err != nil {
return err
}

View File

@@ -117,8 +117,8 @@ func TestCompareDashboardVersions(t *testing.T) {
cmd := m.CompareDashboardVersionsCommand{
DashboardId: savedDash.Id,
Original: query.Result[0].Version,
New: query.Result[1].Version,
BaseVersion: query.Result[0].Version,
NewVersion: query.Result[1].Version,
DiffType: m.DiffDelta,
}
@@ -130,8 +130,8 @@ func TestCompareDashboardVersions(t *testing.T) {
Convey("Compare two versions that are the same", func() {
cmd := m.CompareDashboardVersionsCommand{
DashboardId: savedDash.Id,
Original: savedDash.Version,
New: savedDash.Version,
BaseVersion: savedDash.Version,
NewVersion: savedDash.Version,
DiffType: m.DiffDelta,
}
@@ -143,8 +143,8 @@ func TestCompareDashboardVersions(t *testing.T) {
Convey("Compare two versions that don't exist", func() {
cmd := m.CompareDashboardVersionsCommand{
DashboardId: savedDash.Id,
Original: 123,
New: 456,
BaseVersion: 123,
NewVersion: 456,
DiffType: m.DiffDelta,
}