How to use the @angular/fire/database-deprecated.FirebaseListFactory function in @angular/fire

To help you get started, we’ve selected a few @angular/fire examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular / angularfire / src / database-deprecated / firebase_list_factory.spec.ts View on Github external
it('startAt - should re-run a query when the observable value has emitted', (done: any) => {

        const subject = new Subject();
        const observable = FirebaseListFactory(app.database().ref(questionsPath), {
          query: {
            orderByKey: true,
            startAt: subject
          }
        });

        queryTest(observable, subject, done);
      });
github angular / angularfire / src / database-deprecated / firebase_list_factory.spec.ts View on Github external
it('should have a a FirebaseListObservable shape when queried', () => {
        const observable = FirebaseListFactory(app.database().ref(questionsPath), {
          query: {
            orderByChild: 'height',
            equalTo: '1'
          }
        });

        expect(observable.push instanceof Function).toBe(true);
        expect(observable.update instanceof Function).toBe(true);
        expect(observable.remove instanceof Function).toBe(true);
    });
  });
github angular / angularfire / src / database-deprecated / firebase_list_factory.spec.ts View on Github external
it('should throw an error if startAt and endAt is used with equalTo', () => {

        const observable = FirebaseListFactory(app.database().ref(questionsPath), {
          query: {
            orderByChild: 'height',
            equalTo: 10,
            endAt: 100,
            startAt: 103
          }
        });
        expect(observable.subscribe).toThrowError();
      });
github angular / angularfire / src / database-deprecated / firebase_list_factory.spec.ts View on Github external
it('should call off on all events when disposed', (done: any) => {
      const questionRef = app.database().ref().child('questions');
      subscription = FirebaseListFactory(questionRef).subscribe(_ => {
        let firebaseSpy = spyOn(questionRef, 'off').and.callThrough();
        expect(firebaseSpy).not.toHaveBeenCalled();
        subscription.unsubscribe();
        expect(firebaseSpy).toHaveBeenCalled();
        done();
      });
    });
github angular / angularfire / src / database-deprecated / firebase_list_factory.spec.ts View on Github external
it('should accept a Firebase db ref in the constructor', () => {
      const list = FirebaseListFactory(app.database().ref(`questions`));
      expect(list instanceof FirebaseListObservable).toBe(true);
    });
github angular / angularfire / src / database-deprecated / firebase_list_factory.spec.ts View on Github external
.then(() => {

          let query1 = FirebaseListFactory(app.database().ref(`questions`), {
            query: {
              orderByChild: 'data',
              startAt: { value: 0 }
            }
          });
          let promise1 = toPromise.call(take.call(query1, 1));

          let query2 = FirebaseListFactory(app.database().ref(`questions`), {
            query: {
              orderByChild: 'data',
              startAt: { value: 0, key: 'val2' }
            }
          });
          let promise2 = toPromise.call(take.call(query2, 1));

          Promise.all([promise1, promise2]).then(([list1, list2]) => {
            expect(list1.map((i: any) => i.$key)).toEqual(['val1', 'val2', 'val3']);
            expect(list2.map((i: any) => i.$key)).toEqual(['val2', 'val3']);
            done();
          });
        })
        .catch(done.fail);
github angular / angularfire / src / database-deprecated / firebase_list_factory.spec.ts View on Github external
beforeEach((done: any) => {
      toKey = (val: any) => val.key;
      val1 = { key: 'key1' };
      val2 = { key: 'key2' };
      val3 = { key: 'key3' };
      app.database().ref().remove(done);
      questions = FirebaseListFactory(app.database().ref(`questions`));
      questionsSnapshotted = FirebaseListFactory(app.database().ref(`questionssnapshot`), { preserveSnapshot: true });
      ref = questions.$ref;
      refSnapshotted = questionsSnapshotted.$ref;
    });
github angular / angularfire / src / database-deprecated / firebase_list_factory.spec.ts View on Github external
beforeEach((done: any) => {
      toKey = (val: any) => val.key;
      val1 = { key: 'key1' };
      val2 = { key: 'key2' };
      val3 = { key: 'key3' };
      app.database().ref().remove(done);
      questions = FirebaseListFactory(app.database().ref(`questions`));
      questionsSnapshotted = FirebaseListFactory(app.database().ref(`questionssnapshot`), { preserveSnapshot: true });
      ref = questions.$ref;
      refSnapshotted = questionsSnapshotted.$ref;
    });
github angular / angularfire / src / database-deprecated / firebase_list_factory.spec.ts View on Github external
.then(() => {

          let subject = new Subject();
          let query = FirebaseListFactory(app.database().ref(`questions`), {
            query: {
              orderByChild: 'even',
              equalTo: subject
            }
          });

          query = map.call(query, (list: any, index: any) => {
            switch (index) {
            case 0:
              subject.next(true);
              break;
            case 1:
              questions.$ref.ref.update({
                key3: { even: false, value: 3 },
                key4: { even: true, value: 4 }
              });
github angular / angularfire / src / database-deprecated / firebase_list_factory.spec.ts View on Github external
.then(() => {

          let query1 = FirebaseListFactory(app.database().ref(`questions`), {
            query: {
              orderByChild: 'data',
              equalTo: { value: 0 }
            }
          });
          let promise1 = toPromise.call(take.call(query1, 1));

          let query2 = FirebaseListFactory(app.database().ref(`questions`), {
            query: {
              orderByChild: 'data',
              equalTo: { value: 0, key: 'val2' }
            }
          });
          let promise2 = toPromise.call(take.call(query2, 1));

          Promise.all([promise1, promise2]).then(([list1, list2]) => {