github.com/chasestarr/deis@v1.13.5-0.20170519182049-1d9e59fbdbfc/client/controller/api/apps_test.go (about)

     1  package api
     2  
     3  import (
     4  	"sort"
     5  	"testing"
     6  )
     7  
     8  func TestAppsSorted(t *testing.T) {
     9  	apps := Apps{
    10  		{"2014-01-01T00:00:00UTC", "Zulu", "John", "2016-01-02", "zulu.example.com", "d57be2ba-7ae2-4825-9ace-7c86cb893046"},
    11  		{"2014-01-01T00:00:00UTC", "Alpha", "John", "2016-01-02", "alpha.example.com", "3d501190-1b8e-41ef-94c5-dd9a0bb707bb"},
    12  		{"2014-01-01T00:00:00UTC", "Gamma", "John", "2016-01-02", "gamma.example.com", "41d95133-fd4d-4f4c-92a2-e454857371cc"},
    13  		{"2014-01-01T00:00:00UTC", "Beta", "John", "2016-01-02", "beta.example.com", "222ed1aa-e985-4bec-9966-a88215300661"},
    14  	}
    15  
    16  	sort.Sort(apps)
    17  	expectedAppNames := []string{"Alpha", "Beta", "Gamma", "Zulu"}
    18  
    19  	for i, app := range apps {
    20  		if expectedAppNames[i] != app.ID {
    21  			t.Errorf("Expected apps to be sorted %v, Got %v at index %v", expectedAppNames[i], app.ID, i)
    22  		}
    23  	}
    24  }