Skip to content

Commit 323de07

Browse files
committed
Fix compile errors
Also added a TODO for a testing util.
1 parent 4411523 commit 323de07

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

src/commons/sagas/SideContentSaga.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Action } from 'redux';
22
import type { SagaIterator } from 'redux-saga';
33
import { put, take } from 'redux-saga/effects';
44
import { notifyStoriesEvaluated } from 'src/features/stories/StoriesActions';
5-
import { NOTIFY_STORIES_EVALUATED } from 'src/features/stories/StoriesTypes';
65

76
import * as actions from '../sideContent/SideContentActions';
87
import {
@@ -52,7 +51,7 @@ export default function* SideContentSaga(): SagaIterator {
5251
);
5352

5453
yield takeEvery(
55-
NOTIFY_STORIES_EVALUATED,
54+
notifyStoriesEvaluated.type,
5655
function* (action: ReturnType<typeof notifyStoriesEvaluated>) {
5756
yield put(actions.spawnSideContent(`stories.${action.payload.env}`, action.payload));
5857
}

src/commons/sagas/WorkspaceSaga/helpers/evalCode.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import * as Sourceror from 'sourceror';
1111
import { makeCCompilerConfig, specialCReturnObject } from 'src/commons/utils/CToWasmHelper';
1212
import { javaRun } from 'src/commons/utils/JavaHelper';
1313
import { notifyStoriesEvaluated } from 'src/features/stories/StoriesActions';
14-
import { EVAL_STORY } from 'src/features/stories/StoriesTypes';
1514

1615
import { EventType } from '../../../../features/achievement/AchievementTypes';
1716
import { isSchemeLanguage, OverallState } from '../../../application/ApplicationTypes';
@@ -48,7 +47,7 @@ export function* evalCode(
4847
): SagaIterator {
4948
context.runtime.debuggerOn =
5049
(actionType === EVAL_EDITOR || actionType === DEBUG_RESUME) && context.chapter > 2;
51-
const isStoriesBlock = actionType === EVAL_STORY || workspaceLocation === 'stories';
50+
const isStoriesBlock = actionType === actions.evalStory.type || workspaceLocation === 'stories';
5251

5352
// Logic for execution of substitution model visualizer
5453
const correctWorkspace = workspaceLocation === 'playground' || workspaceLocation === 'sicp';

src/commons/utils/TestUtils.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,19 @@ export function deepFilter<T>(
4747
helper(nestedObject);
4848
return matches;
4949
}
50+
51+
// TODO: Fix type inference for this function,
52+
// then use it in tests. We no longer need to
53+
// check the action type as everything gets migrated
54+
// to RTK and explicit action types are no longer needed.
55+
// /**
56+
// * The `expectActionPayload` function is used to test the payload
57+
// * of an action.
58+
// * @param action The action to test
59+
// */
60+
// export function expectActionPayload<Action extends ActionCreatorWithPreparedPayload<any, any>>(
61+
// action: ReturnType<Action>
62+
// ) {
63+
// const payload: ReturnType<Action>['payload'] = action.payload;
64+
// return expect(payload);
65+
// }

0 commit comments

Comments
 (0)