How to use @redux-saga/testing-utils - 10 common examples

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 redux-saga / redux-saga / packages / testing-utils / __tests__ / typescript / cloneableGenerator.ts View on Github external
function testCloneableGenerator3() {
  function* testSaga(n1: number, n2: number, n3: number): SagaIterator {
    yield put({type: 'my-action'});
  }

  // typings:expect-error
  cloneableGenerator(testSaga)(1, 2);

  cloneableGenerator(testSaga)(1, 2, 3);
}
github redux-saga / redux-saga / packages / testing-utils / __tests__ / typescript / cloneableGenerator.ts View on Github external
function testCloneableGenerator1() {
  function* testSaga(n1: number): SagaIterator {
    yield put({type: 'my-action'});
  }

  // typings:expect-error
  cloneableGenerator(testSaga)();

  // typings:expect-error
  cloneableGenerator(testSaga)('foo');

  cloneableGenerator(testSaga)(1);
}
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 redux-saga / redux-saga / packages / testing-utils / __tests__ / typescript / cloneableGenerator.ts View on Github external
function testCloneableGenerator5() {
  function* testSaga(
    n1: number,
    n2: number,
    n3: number,
    n4: number,
    n5: number,
  ): SagaIterator {
    yield put({type: 'my-action'});
  }
  cloneableGenerator(testSaga)(1, 2, 3, 4, 5);
}
github redux-saga / redux-saga / packages / testing-utils / __tests__ / typescript / cloneableGenerator.ts View on Github external
function testCloneableGenerator6Rest() {
  function* testSaga(
    n1: number,
    n2: number,
    n3: number,
    n4: number,
    n5: number,
    n6: number,
    n7: number,
  ): SagaIterator {
    yield put({type: 'my-action'});
  }
  cloneableGenerator(testSaga)(1, 2, 3, 4, 5, 6, 7);
}
github redux-saga / redux-saga / packages / testing-utils / __tests__ / typescript / cloneableGenerator.ts View on Github external
function testCloneableGenerator6() {
  function* testSaga(
    n1: number,
    n2: number,
    n3: number,
    n4: number,
    n5: number,
    n6: number,
  ): SagaIterator {
    yield put({type: 'my-action'});
  }
  cloneableGenerator(testSaga)(1, 2, 3, 4, 5, 6);
}
github redux-saga / redux-saga / packages / testing-utils / __tests__ / typescript / cloneableGenerator.ts View on Github external
function testCloneableGenerator4() {
  function* testSaga(
    n1: number,
    n2: number,
    n3: number,
    n4: number,
  ): SagaIterator {
    yield put({type: 'my-action'});
  }
  cloneableGenerator(testSaga)(1, 2, 3, 4);
}
github redux-saga / redux-saga / packages / testing-utils / __tests__ / typescript / cloneableGenerator.ts View on Github external
function testCloneableGenerator() {
  function* testSaga(): SagaIterator {
    yield put({type: 'my-action'});
  }

  const cloneableGen = cloneableGenerator(testSaga)();
  const value = cloneableGen.next().value;

  const clone = cloneableGen.clone();
  const cloneVal = clone.next().value;
}

@redux-saga/testing-utils

Redux-saga simple testing utils.

MIT
Latest version published 3 months ago

Package Health Score

82 / 100
Full package analysis