Index: impl/memory/datastore_test.go |
diff --git a/impl/memory/datastore_test.go b/impl/memory/datastore_test.go |
index 2f22e3dedc72c2fee1e1de93ec3cff256c3eeada..c84ce087623e1efaab0e68b48436ebc5f975aee8 100644 |
--- a/impl/memory/datastore_test.go |
+++ b/impl/memory/datastore_test.go |
@@ -5,6 +5,7 @@ |
package memory |
import ( |
+ "bytes" |
"fmt" |
"testing" |
"time" |
@@ -528,6 +529,80 @@ func TestDatastoreSingleReadWriter(t *testing.T) { |
So(err, ShouldBeNil) |
So(count, ShouldEqual, 1) // normally this would include __entity_group__ |
}) |
+ |
+ Convey("Testable.ParseIndexYAML", func() { |
+ yaml := ` |
+indexes: |
+ |
+- kind: Cat |
+ ancestor: no |
+ properties: |
+ - name: name |
+ - name: age |
+ direction: desc |
+ |
+- kind: Cat |
+ properties: |
+ - name: name |
+ direction: asc |
+ - name: whiskers |
+ direction: desc |
+ |
+- kind: Store |
+ ancestor: yes |
+ properties: |
+ - name: business |
+ direction: asc |
+ - name: owner |
+ direction: asc |
+` |
+ idxs := ds.Testable().ParseIndexYAML(bytes.NewBufferString(yaml)) |
+ expected := []*dsS.IndexDefinition{ |
+ { |
+ Kind: "Cat", |
+ Ancestor: false, |
+ SortBy: []dsS.IndexColumn{ |
+ { |
+ Property: "name", |
+ Descending: false, |
+ }, |
+ { |
+ Property: "age", |
+ Descending: true, |
+ }, |
+ }, |
+ }, |
+ { |
+ Kind: "Cat", |
+ Ancestor: false, |
+ SortBy: []dsS.IndexColumn{ |
+ { |
+ Property: "name", |
+ Descending: false, |
+ }, |
+ { |
+ Property: "whiskers", |
+ Descending: true, |
+ }, |
+ }, |
+ }, |
+ { |
+ Kind: "Store", |
+ Ancestor: true, |
+ SortBy: []dsS.IndexColumn{ |
+ { |
+ Property: "business", |
+ Descending: false, |
+ }, |
+ { |
+ Property: "owner", |
+ Descending: false, |
+ }, |
+ }, |
+ }, |
+ } |
+ So(idxs, ShouldResembleV, expected) |
+ }) |
}) |
dnj
2016/01/13 16:16:40
Also test filesystem walking using a tempdir.
nishanths (utexas)
2016/01/14 21:15:14
Done. :) The tests are now in service/datastore/da
|
} |