How to use the superagent.query function in superagent

To help you get started, we’ve selected a few superagent 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 Sage / carbon / src / utils / helpers / poller / __spec__.js View on Github external
it('makes a get request with the provided params', () => {
        Request.query = jest.fn().mockReturnThis();
        Poller({
          url,
          data: {
            foo: 'bar',
            headers: {
              Accept: 'application/json'
            }
          }
        }, functions, { interval: 1000 });

        expect(Request.query).toBeCalledWith({
          foo: 'bar',
          headers: {
            Accept: 'application/json'
          }
        });
github Sage / carbon / src / components / dropdown-filter-ajax / __spec__.js View on Github external
it('calls the correct query', () => {
        Request.query = jest.fn().mockReturnThis();
        instance.ajaxUpdateList = jest.fn();

        instance.getData("foo", 1);

        expect(Request.query).toBeCalledWith({
          page: 1,
          rows: 25,
          value: 'foo'
        });
      });
github Sage / carbon / src / components / table-ajax / __spec__.js View on Github external
it('queries for the data after 250ms', () => {
      Request.query = jest.fn().mockReturnThis();
      instance.emitOnChangeCallback('data', options);

      expect(Request.query.mock.calls.length).toBe(0);

      jest.runTimersToTime(251);
      expect(Request.query).toBeCalledWith('page=1&rows=10');
    });