diff options
author | =Corey Hulen <corey@hulen.com> | 2016-01-28 11:39:48 -0500 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2016-01-28 11:39:48 -0500 |
commit | 2138b46f6cdab5fca49680c2e1994703ab71b1c3 (patch) | |
tree | d143d3dc67122019d96d135ae5f2fe39b79ace7c /model/version_test.go | |
parent | fa6daad64d474e99f3a2964784585a748350c25a (diff) | |
download | chat-2138b46f6cdab5fca49680c2e1994703ab71b1c3.tar.gz chat-2138b46f6cdab5fca49680c2e1994703ab71b1c3.tar.bz2 chat-2138b46f6cdab5fca49680c2e1994703ab71b1c3.zip |
PLT-1765 allowing support of 2 previous versions
Diffstat (limited to 'model/version_test.go')
-rw-r--r-- | model/version_test.go | 52 |
1 files changed, 44 insertions, 8 deletions
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() + } +} |