How to use the redux-saga-test-plan.testSaga function in redux-saga-test-plan

To help you get started, we’ve selected a few redux-saga-test-plan 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 / user.js View on Github external
t.test('not dismissed during undo period, successful migration', assert => {
    testSaga(startAccountMigrationSaga, startAccountMigration())
      .next()
      .inspect(effect => {
        assert.deepEqual(
          effect,
          race({
            shouldContinue: delay(5000, true),
            cancel: take('DISMISS_ACCOUNT_MIGRATION'),
          }),
        );
      })
      .next({shouldContinue: true, cancel: null})
      .put(accountMigrationUndoPeriodExpired())
      .next()
      .select(getCurrentAccountMigration)
      .next(migration)
      .call(migrateAccount, firebaseCredential)
github popcodeorg / popcode / test / unit / sagas / ui.js View on Github external
test('userDoneTyping', assert => {
  testSaga(userDoneTypingSaga)
    .next()
    .put(userDoneTyping())
    .next()
    .isDone();
  assert.end();
});
github popcodeorg / popcode / test / unit / sagas / projects.js View on Github external
test('toggleLibrary', assert => {
  const scenario = new Scenario();
  const userId = 'abc123';
  const currentProject = project();
  const {projectKey} = currentProject;
  testSaga(toggleLibrarySaga, toggleLibrary(scenario.projectKey, 'jquery'))
    .next()
    .select(getCurrentProject)
    .next(currentProject)
    .select()
    .next(scenario.state)
    .call(getCurrentUserId, scenario.state)
    .next(userId)
    .call(getProject, scenario.state, {projectKey})
    .next(currentProject)
    .call(saveProject, userId, currentProject)
    .next()
    .put(projectSuccessfullySaved())
    .next()
    .isDone();
  assert.end();
});
github popcodeorg / popcode / test / unit / sagas / assignments.js View on Github external
t.test('draft', assert => {
    const assignmentState = 'DRAFT';
    const assignment = {};
    testSaga(createAssignmentSaga, {
      payload: {
        selectedCourseId,
        dueDate,
        assignmentState,
      },
    })
      .next()
      .select(getCurrentProject)
      .next(project.toJS())
      .call(createProjectSnapshot, project.toJS())
      .next(snapshotKey)
      .all([
        call(createSnapshotUrl, snapshotKey),
        call(generateTextPreview, project.toJS()),
      ])
      .next([url, title])
github popcodeorg / popcode / test / unit / sagas / projects.js View on Github external
t.test('with successful import', assert => {
    const saga = testSaga(importGistSaga, applicationLoaded({gistId}));

    saga.next().call(loadGistFromId, gistId);

    const gist = gistData({html: 'test'});
    saga.next(gist).inspect(effect => {
      assert.equals(effect.type, 'PUT', 'yielded effect is a PUT');
      assert.equal(
        effect.payload.action.type,
        'GIST_IMPORTED',
        'action is GIST_IMPORTED',
      );
      assert.ok(
        effect.payload.action.payload.projectKey,
        'assigns a project key',
      );
      assert.deepEqual(
github popcodeorg / popcode / test / unit / sagas / projects.js View on Github external
test('changeCurrentProject()', assert => {
  const scenario = new Scenario();
  const userId = 'abc123';
  const currentProject = project();
  const {projectKey} = currentProject;

  testSaga(changeCurrentProjectSaga)
    .next()
    .select(getCurrentProject)
    .next(currentProject)
    .select()
    .next(scenario.state)
    .call(getCurrentUserId, scenario.state)
    .next(userId)
    .call(getProject, scenario.state, {projectKey})
    .next(currentProject)
    .call(saveProject, userId, currentProject)
    .next()
    .put(projectSuccessfullySaved())
    .next()
    .isDone();
  assert.end();
});
github popcodeorg / popcode / test / unit / sagas / manageUserState.js View on Github external
assert.doesNotThrow(() => {
      testSaga(handleAuthError, e)
        .next()
        .put(notificationTriggered('auth-error'))
        .next()
        .call([bugsnagClient, 'notify'], e, {
          metaData: {code: 'auth/bogus-error'},
        })
        .next()
        .isDone();
    });
github popcodeorg / popcode / test / unit / sagas / compiledProjects.js View on Github external
function startCompilation() {
    const project = projectFactory();

    return testSaga(validatedSourceSaga)
      .next()
      .select(getErrors)
      .next(errors.noErrors.toJS())
      .select(getCurrentProject)
      .next(project)
      .call(compileProject, project, {isInlinePreview: true});
  }
});
github cockroachdb / cockroach-gen / pkg / ui / src / redux / metrics.spec.ts View on Github external
it("initially waits for incoming request objects", function () {
        testSaga(metrics.queryMetricsSaga).next().take(metrics.REQUEST);
      });
github cockroachdb / cockroach-gen / pkg / ui / src / redux / queryManager / saga.spec.ts View on Github external
it("correctly handles STOP_AUTO_REFRESH action", function() {
                const state = new ManagedQuerySagaState();
                state.channel = channel();
                testSaga(processQueryManagementAction, state)
                    .next()
                    .take(state.channel)
                    .next(stopAutoRefresh(testQueryCounter))
                    .isDone();
                const expected = new ManagedQuerySagaState();
                expected.channel = state.channel;
                expected.autoRefreshCount = -1;
                assert.equal(state.autoRefreshCount, -1);
                assert.deepEqual(state, expected);
            });
        });