Re-fix issue 495

This commit is contained in:
Sam Stern
2018-12-21 08:05:51 -08:00
parent 853db2e971
commit 5256f745e2
3 changed files with 11 additions and 2 deletions

View File

@@ -0,0 +1 @@
fixed - Firestore Indexes deploy no longer crashes on an empty spec.

View File

@@ -453,8 +453,8 @@ export class FirestoreIndexes {
fieldOverrides: spec.fieldOverrides || [],
};
if (!spec.indexes) {
return;
if (!(spec.indexes && spec.indexes.length > 0)) {
return result;
}
// Try to detect use of the old API, warn the users.

View File

@@ -40,6 +40,14 @@ describe("IndexValidation", () => {
expect(upgraded).to.eql(VALID_SPEC);
});
it("should accept an empty spec", () => {
const empty = {
indexes: [],
};
idx.validateSpec(idx.upgradeOldSpec(empty));
});
it("should accept a valid v1beta1 index spec after upgrade", () => {
idx.validateSpec(
idx.upgradeOldSpec({