How to use the @redux-saga/testing-utils.createMockTask function in @redux-saga/testing-utils

To help you get started, we’ve selected a few @redux-saga/testing-utils 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 popcodeorg / popcode / test / unit / sagas / errors.js View on Github external
t.test('another validation initiated', assert => {
    const tasks = new Map();
    const firstTask = createMockTask();
    const secondTask = createMockTask();
    testSaga(validateSourceSaga, tasks, action)
      .next()
      .call(importValidations)
      .next({javascript})
      .fork(javascript, source, projectAttributes)
      .next(firstTask)
      .join(firstTask);

    testSaga(validateSourceSaga, tasks, action)
      .next()
      .cancel(firstTask)
      .next()
      .call(importValidations)
      .next({javascript})
      .fork(javascript, source, projectAttributes)
      .next(secondTask)
github popcodeorg / popcode / test / unit / sagas / errors.js View on Github external
t.test('another validation initiated', assert => {
    const tasks = new Map();
    const firstTask = createMockTask();
    const secondTask = createMockTask();
    testSaga(validateSourceSaga, tasks, action)
      .next()
      .call(importValidations)
      .next({javascript})
      .fork(javascript, source, projectAttributes)
      .next(firstTask)
      .join(firstTask);

    testSaga(validateSourceSaga, tasks, action)
      .next()
      .cancel(firstTask)
      .next()
      .call(importValidations)
      .next({javascript})
      .fork(javascript, source, projectAttributes)
github popcodeorg / popcode / test / unit / sagas / errors.js View on Github external
t.test('validation completes', assert => {
    const tasks = new Map();
    const task = createMockTask();
    testSaga(validateSourceSaga, tasks, action)
      .next()
      .call(importValidations)
      .next({javascript})
      .fork(javascript, source, projectAttributes)
      .next(task)
      .join(task)
      .next(errors)
      .put(validatedSource(language, errors))
      .next()
      .isDone();
    assert.end();
  });
github woltapp / redux-autoloader / src / sagas.spec.js View on Github external
test('should cancel autoRefresh task if it is running', () => {
      const mockLoaderTask = createMockTask();
      mockLoaderTask.name = 'autoRefresh';
      mockLoaderTask.meta = { loader: 'test-loader' };
      const startGen = dataLoaderFlow(startRefreshAction);
      startGen.next();
      startGen.next(mockLoaderTask);
      expect(gen.next(stopRefreshAction).value).toEqual(cancel(mockLoaderTask));
    });
  });

@redux-saga/testing-utils

Redux-saga simple testing utils.

MIT
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis