Add tests, stop omitting connections to skip a problem
parent
741f527d44
commit
3189ef20c7
|
|
@ -3,7 +3,9 @@
|
||||||
function main() {
|
function main() {
|
||||||
cd "$(dirname "$BASH_SOURCE")"
|
cd "$(dirname "$BASH_SOURCE")"
|
||||||
set -e
|
set -e
|
||||||
|
if [ -z "$NOTEST" ]; then
|
||||||
go test ./...
|
go test ./...
|
||||||
|
fi
|
||||||
GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=0 go build -o $(basename "$PWD") -a -installsuffix cgo
|
GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=0 go build -o $(basename "$PWD") -a -installsuffix cgo
|
||||||
scp ./public/swagger/* zach@tickle.lan:./dndex/files/swagger/
|
scp ./public/swagger/* zach@tickle.lan:./dndex/files/swagger/
|
||||||
scp ./dndex zach@tickle.lan:./dndex/dndex.new
|
scp ./dndex zach@tickle.lan:./dndex/dndex.new
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ type One struct {
|
||||||
Text string `bson:"text,omitempty" json:"text,omitempty"`
|
Text string `bson:"text,omitempty" json:"text,omitempty"`
|
||||||
Relationship string `bson:"relationship,omitempty" json:"relationship,omitempty"`
|
Relationship string `bson:"relationship,omitempty" json:"relationship,omitempty"`
|
||||||
Modified int64 `bson:"modified,omitempty" json:"modified,omitempty"`
|
Modified int64 `bson:"modified,omitempty" json:"modified,omitempty"`
|
||||||
Connections map[string]One `bson:"connections,omitempty" json:"connections,omitempty"`
|
Connections map[string]One `bson:"connections" json:"connections,omitempty"`
|
||||||
Attachments map[string]string `bson:"attachments,omitempty" json:"attachments,omitempty"`
|
Attachments map[string]string `bson:"attachments,omitempty" json:"attachments,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,6 @@ func randomOne() entity.One {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//func sortOnes(ones []entity.One, r *http.Request) []entity.One {
|
|
||||||
func TestSortOnes(t *testing.T) {
|
func TestSortOnes(t *testing.T) {
|
||||||
oneA := entity.One{Name: "A", Title: "c", Modified: 2}
|
oneA := entity.One{Name: "A", Title: "c", Modified: 2}
|
||||||
oneB := entity.One{Name: "B", Title: "b", Modified: 1}
|
oneB := entity.One{Name: "B", Title: "b", Modified: 1}
|
||||||
|
|
@ -412,6 +411,18 @@ func TestSortOnes(t *testing.T) {
|
||||||
ones: []entity.One{oneA, oneB, oneC},
|
ones: []entity.One{oneA, oneB, oneC},
|
||||||
test: func(a, b entity.One) bool { return a.Modified >= b.Modified },
|
test: func(a, b entity.One) bool { return a.Modified >= b.Modified },
|
||||||
},
|
},
|
||||||
|
"default: modified desc, custom entries": {
|
||||||
|
ones: []entity.One{
|
||||||
|
entity.One{Modified: 2},
|
||||||
|
entity.One{Modified: 5},
|
||||||
|
entity.One{Modified: 7},
|
||||||
|
entity.One{Modified: 3},
|
||||||
|
entity.One{Modified: 4},
|
||||||
|
entity.One{Modified: 1},
|
||||||
|
entity.One{Modified: 6},
|
||||||
|
},
|
||||||
|
test: func(a, b entity.One) bool { return a.Modified >= b.Modified },
|
||||||
|
},
|
||||||
"default=modified set=desc": {
|
"default=modified set=desc": {
|
||||||
ones: []entity.One{oneA, oneB, oneC},
|
ones: []entity.One{oneA, oneB, oneC},
|
||||||
order: "-1",
|
order: "-1",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue