A few more firestore tests
This commit is contained in:
parent
8160431811
commit
49757eb56d
|
@ -322,7 +322,12 @@ export default class Query {
|
|||
// validate.isFieldPath('fieldPath', fieldPath);
|
||||
// validate.isOptionalFieldOrder('directionStr', directionStr);
|
||||
|
||||
if (this._queryOptions.startAt || this._queryOptions.endAt) {
|
||||
if (
|
||||
this._queryOptions.startAt ||
|
||||
this._queryOptions.startAfter ||
|
||||
this._queryOptions.endAt ||
|
||||
this._queryOptions.endBefore
|
||||
) {
|
||||
throw new Error(
|
||||
'Cannot specify an orderBy() constraint after calling ' +
|
||||
'startAt(), startAfter(), endBefore() or endAt().'
|
||||
|
|
|
@ -508,6 +508,13 @@ function collectionReferenceTests({
|
|||
}).should.throw(
|
||||
'Query.onSnapshot failed: Observer.error must be a valid function.'
|
||||
);
|
||||
(() => {
|
||||
colRef.onSnapshot({
|
||||
next: 'error',
|
||||
});
|
||||
}).should.throw(
|
||||
'Query.onSnapshot failed: Observer.next must be a valid function.'
|
||||
);
|
||||
(() => {
|
||||
colRef.onSnapshot(
|
||||
{
|
||||
|
@ -1129,6 +1136,56 @@ function collectionReferenceTests({
|
|||
});
|
||||
});
|
||||
|
||||
context('orderBy()', () => {
|
||||
it('errors if called after startAt', () => {
|
||||
(() => {
|
||||
firebase.native
|
||||
.firestore()
|
||||
.collection('collections')
|
||||
.startAt({})
|
||||
.orderBy('test');
|
||||
}).should.throw(
|
||||
'Cannot specify an orderBy() constraint after calling startAt(), startAfter(), endBefore() or endAt().'
|
||||
);
|
||||
});
|
||||
|
||||
it('errors if called after startAfter', () => {
|
||||
(() => {
|
||||
firebase.native
|
||||
.firestore()
|
||||
.collection('collections')
|
||||
.startAfter({})
|
||||
.orderBy('test');
|
||||
}).should.throw(
|
||||
'Cannot specify an orderBy() constraint after calling startAt(), startAfter(), endBefore() or endAt().'
|
||||
);
|
||||
});
|
||||
|
||||
it('errors if called after endBefore', () => {
|
||||
(() => {
|
||||
firebase.native
|
||||
.firestore()
|
||||
.collection('collections')
|
||||
.endBefore({})
|
||||
.orderBy('test');
|
||||
}).should.throw(
|
||||
'Cannot specify an orderBy() constraint after calling startAt(), startAfter(), endBefore() or endAt().'
|
||||
);
|
||||
});
|
||||
|
||||
it('errors if called after endAt', () => {
|
||||
(() => {
|
||||
firebase.native
|
||||
.firestore()
|
||||
.collection('collections')
|
||||
.endAt({})
|
||||
.orderBy('test');
|
||||
}).should.throw(
|
||||
'Cannot specify an orderBy() constraint after calling startAt(), startAfter(), endBefore() or endAt().'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
context('onSnapshot()', () => {
|
||||
it('gets called correctly', async () => {
|
||||
const collectionRef = collectionTests
|
||||
|
|
|
@ -126,6 +126,26 @@ function firestoreTests({ describe, it, context, firebase }) {
|
|||
});
|
||||
});
|
||||
|
||||
context('disableNetwork()', () => {
|
||||
it('should throw an unsupported error', () => {
|
||||
(() => {
|
||||
firebase.native.firestore().disableNetwork();
|
||||
}).should.throw(
|
||||
'firebase.firestore().disableNetwork() is unsupported by the native Firebase SDKs.'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
context('enableNetwork()', () => {
|
||||
it('should throw an unsupported error', () => {
|
||||
(() => {
|
||||
firebase.native.firestore().enableNetwork();
|
||||
}).should.throw(
|
||||
'firebase.firestore().enableNetwork() is unsupported by the native Firebase SDKs.'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
context('enablePersistence()', () => {
|
||||
it('should throw an unsupported error', () => {
|
||||
(() => {
|
||||
|
|
Loading…
Reference in New Issue