Skip to content

Commit 756288b

Browse files
Adding .skip and .only for validation tests
1 parent 92f3809 commit 756288b

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

packages/firestore/test/integration/api/validation.test.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232

3333
// Since most of our tests are "synchronous" but require a Firestore instance,
3434
// we have a helper wrapper around it() and withTestDb() to optimize for that.
35-
function validationIt(
35+
const validationIt : any = function(
3636
persistence: boolean,
3737
message: string,
3838
testFunction: (db: firestore.FirebaseFirestore) => void | Promise<any>
@@ -45,7 +45,30 @@ function validationIt(
4545
}
4646
});
4747
});
48-
}
48+
};
49+
50+
validationIt.skip = function(
51+
persistence: boolean,
52+
message: string,
53+
_: (db: firestore.FirebaseFirestore) => void | Promise<any>
54+
) {
55+
it.skip(message, () => {});
56+
};
57+
58+
validationIt.only = function(
59+
persistence: boolean,
60+
message: string,
61+
testFunction: (db: firestore.FirebaseFirestore) => void | Promise<any>
62+
) {
63+
it.only(message, () => {
64+
return withTestDb(persistence, async db => {
65+
const maybePromise = testFunction(db);
66+
if (maybePromise) {
67+
return maybePromise;
68+
}
69+
});
70+
});
71+
};
4972

5073
// NOTE: The JS SDK does extensive validation of argument counts, types, etc.
5174
// since it is an untyped language. These tests are not exhaustive as that would

0 commit comments

Comments
 (0)