-
Notifications
You must be signed in to change notification settings - Fork 937
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Support Vector Config in the indexes.json file * Fix up unnecessary dependencies in test file * Fix up linter warnings * Fixes for printer test * Some small adjustments to the sort method
- Loading branch information
1 parent
dc13cb9
commit 90b6506
Showing
6 changed files
with
260 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { expect } from "chai"; | ||
import * as API from "../../firestore/api-types"; | ||
import { PrettyPrint } from "../../firestore/pretty-print"; | ||
|
||
const printer = new PrettyPrint(); | ||
|
||
describe("prettyIndexString", () => { | ||
it("should correctly print an order type Index", () => { | ||
expect( | ||
printer.prettyIndexString( | ||
{ | ||
name: "/projects/project/databases/(default)/collectionGroups/collectionB/indexes/a", | ||
queryScope: API.QueryScope.COLLECTION, | ||
fields: [ | ||
{ fieldPath: "foo", order: API.Order.ASCENDING }, | ||
{ fieldPath: "bar", order: API.Order.DESCENDING }, | ||
], | ||
}, | ||
false, | ||
), | ||
).to.contain("(foo,ASCENDING) (bar,DESCENDING) "); | ||
}); | ||
|
||
it("should correctly print a contains type Index", () => { | ||
expect( | ||
printer.prettyIndexString( | ||
{ | ||
name: "/projects/project/databases/(default)/collectionGroups/collectionB/indexes/a", | ||
queryScope: API.QueryScope.COLLECTION, | ||
fields: [ | ||
{ fieldPath: "foo", order: API.Order.ASCENDING }, | ||
{ fieldPath: "baz", arrayConfig: API.ArrayConfig.CONTAINS }, | ||
], | ||
}, | ||
false, | ||
), | ||
).to.contain("(foo,ASCENDING) (baz,CONTAINS) "); | ||
}); | ||
|
||
it("should correctly print a vector type Index", () => { | ||
expect( | ||
printer.prettyIndexString( | ||
{ | ||
name: "/projects/project/databases/(default)/collectionGroups/collectionB/indexes/a", | ||
queryScope: API.QueryScope.COLLECTION, | ||
fields: [{ fieldPath: "foo", vectorConfig: { dimension: 100, flat: {} } }], | ||
}, | ||
false, | ||
), | ||
).to.contain("(foo,VECTOR<100>) "); | ||
}); | ||
|
||
it("should correctly print a vector type Index with other fields", () => { | ||
expect( | ||
printer.prettyIndexString( | ||
{ | ||
name: "/projects/project/databases/(default)/collectionGroups/collectionB/indexes/a", | ||
queryScope: API.QueryScope.COLLECTION, | ||
fields: [ | ||
{ fieldPath: "foo", order: API.Order.ASCENDING }, | ||
{ fieldPath: "bar", vectorConfig: { dimension: 200, flat: {} } }, | ||
], | ||
}, | ||
false, | ||
), | ||
).to.contain("(foo,ASCENDING) (bar,VECTOR<200>) "); | ||
}); | ||
}); |