From 2138b46f6cdab5fca49680c2e1994703ab71b1c3 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Thu, 28 Jan 2016 11:39:48 -0500 Subject: PLT-1765 allowing support of 2 previous versions --- model/version_test.go | 52 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 8 deletions(-) (limited to 'model/version_test.go') diff --git a/model/version_test.go b/model/version_test.go index 33e8dc93e..d73273ce5 100644 --- a/model/version_test.go +++ b/model/version_test.go @@ -36,20 +36,28 @@ func TestSplitVersion(t *testing.T) { } func TestGetPreviousVersion(t *testing.T) { - if major, minor := GetPreviousVersion("1.0.0"); major != 0 || minor != 7 { - t.Fatal(major, minor) + if GetPreviousVersion("1.3.0") != "1.2.0" { + t.Fatal() + } + + if GetPreviousVersion("1.2.1") != "1.1.0" { + t.Fatal() + } + + if GetPreviousVersion("1.1.0") != "1.0.0" { + t.Fatal() } - if major, minor := GetPreviousVersion("0.7.0"); major != 0 || minor != 6 { - t.Fatal(major, minor) + if GetPreviousVersion("1.0.0") != "0.7.0" { + t.Fatal() } - if major, minor := GetPreviousVersion("0.7.1"); major != 0 || minor != 6 { - t.Fatal(major, minor) + if GetPreviousVersion("0.7.1") != "0.6.0" { + t.Fatal() } - if major, minor := GetPreviousVersion("0.7111.1"); major != 0 || minor != 0 { - t.Fatal(major, minor) + if GetPreviousVersion("0.5.0") != "" { + t.Fatal() } } @@ -72,3 +80,31 @@ func TestIsCurrentVersion(t *testing.T) { t.Fatal() } } + +func TestIsPreviousVersionsSupported(t *testing.T) { + + // 1.4.0 CURRENT RELEASED VERSION + if !IsPreviousVersionsSupported(versions[0]) { + t.Fatal() + } + + // 1.3.0 + if !IsPreviousVersionsSupported(versions[1]) { + t.Fatal() + } + + // 1.2.1 + if !IsPreviousVersionsSupported(versions[2]) { + t.Fatal() + } + + // 1.2.0 + if !IsPreviousVersionsSupported(versions[3]) { + t.Fatal() + } + + // 1.1.0 NOT SUPPORTED + if IsPreviousVersionsSupported(versions[4]) { + t.Fatal() + } +} -- cgit v1.2.3-1-g7c22