INNER CODE UNIT · TypeScript

sleep

apollographql/apollo-link · packages/apollo-link-context/src/__tests__/index.ts:6

const sleep = ms => new Promise(s => setTimeout(s, ms));
const query = gql`
  query Test {
    foo {
      bar
    }
  }
`;
const data = {
  foo: { bar: true },
};

it('can be used to set the context with a simple function', done => {
  const withContext = setContext(() => ({ dynamicallySet: true }));

  const mockLink = new ApolloLink(operation => {
    expect(operation.getContext().dynamicallySet).toBe(true);
    return Observable.of({ data });

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…