How to use the apollo-link-batch.BatchLink.mock function in apollo-link-batch

To help you get started, we’ve selected a few apollo-link-batch 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 apollographql / apollo-link / packages / apollo-link-batch-http / src / __tests__ / batchHttpLink.ts View on Github external
const batchKey = () => 'hi';
    const batchHandler = operations => Observable.of();

    const batch = new LocalScopedLink({
      batchInterval: 20,
      batchMax: 20,
      batchKey,
      batchHandler,
    });

    const {
      batchInterval,
      batchMax,
      batchKey: batchKeyArg,
    } = BatchLink.mock.calls[0][0];

    expect(batchInterval).toBe(20);
    expect(batchMax).toBe(20);
    expect(batchKeyArg()).toEqual(batchKey());
  });

apollo-link-batch

Apollo Link that performs batching and operation on batched Operations

MIT
Latest version published 4 years ago

Package Health Score

62 / 100
Full package analysis

Similar packages