diff --git a/client/src/templates/Challenges/redux/execute-challenge-saga.js b/client/src/templates/Challenges/redux/execute-challenge-saga.js index 4e51f880c41..2518931c52d 100644 --- a/client/src/templates/Challenges/redux/execute-challenge-saga.js +++ b/client/src/templates/Challenges/redux/execute-challenge-saga.js @@ -341,8 +341,7 @@ function* updatePython(challengeData) { interruptCodeExecution(); const code = { contents: buildData.sources.index, - editableContents: buildData.sources.editableContents, - original: buildData.sources.original + editableContents: buildData.sources.editableContents }; runPythonCode(code); diff --git a/client/src/templates/Challenges/utils/build.ts b/client/src/templates/Challenges/utils/build.ts index 17d18ad40c5..e1d3de02800 100644 --- a/client/src/templates/Challenges/utils/build.ts +++ b/client/src/templates/Challenges/utils/build.ts @@ -74,22 +74,18 @@ const applyFunction = const composeFunctions = (...fns: ApplyFunctionProps[]) => fns.map(applyFunction).reduce((f, g) => x => f(x).then(g)); -// TODO: split this into at least two functions. One to create 'original' i.e. -// the source and another to create the contents. function buildSourceMap(challengeFiles: ChallengeFile[]): Source | undefined { // TODO: rename sources.index to sources.contents. const source: Source | undefined = challengeFiles?.reduce( (sources, challengeFile) => { sources.index += challengeFile.source || ''; sources.contents = sources.index; - sources.original[challengeFile.history[0]] = challengeFile.source ?? null; sources.editableContents += challengeFile.editableContents || ''; return sources; }, { index: '', - editableContents: '', - original: {} + editableContents: '' } as Source ); return source; @@ -181,8 +177,7 @@ function getWorkerTestRunner( ) { const code = { contents: sources.index, - editableContents: sources.editableContents, - original: sources.original + editableContents: sources.editableContents }; interface TestWorkerExecutor extends WorkerExecutor { diff --git a/client/src/templates/Challenges/utils/frame.ts b/client/src/templates/Challenges/utils/frame.ts index 769a77c86ac..6960ed84492 100644 --- a/client/src/templates/Challenges/utils/frame.ts +++ b/client/src/templates/Challenges/utils/frame.ts @@ -13,7 +13,6 @@ export interface Source { index: string; contents?: string; editableContents: string; - original: { [key: string]: string | null }; } interface Hooks { diff --git a/client/src/templates/Challenges/utils/python-worker-handler.ts b/client/src/templates/Challenges/utils/python-worker-handler.ts index be48b9a9c13..0137484e105 100644 --- a/client/src/templates/Challenges/utils/python-worker-handler.ts +++ b/client/src/templates/Challenges/utils/python-worker-handler.ts @@ -8,7 +8,6 @@ let listener: ((event: MessageEvent) => void) | null = null; type Code = { contents: string; editableContents: string; - original: string; }; // We need to keep track of the last code message so we can re-run it if the // worker is reset. @@ -102,7 +101,6 @@ export function interruptCodeExecution(): void { export function runPythonCode(code: { contents: string; editableContents: string; - original: string; }): void { lastCodeMessage = code; getPythonWorker().postMessage({ type: 'run', code }); diff --git a/curriculum/test/test-challenges.js b/curriculum/test/test-challenges.js index 2b22b4fd430..3d590ceb003 100644 --- a/curriculum/test/test-challenges.js +++ b/curriculum/test/test-challenges.js @@ -570,8 +570,7 @@ async function createTestRunner( const code = { contents: sources.index, - editableContents: sources.editableContents, - original: sources.original + editableContents: sources.editableContents }; const buildFunction = buildFunctions[challenge.challengeType]; diff --git a/tools/client-plugins/browser-scripts/frame-runner.ts b/tools/client-plugins/browser-scripts/frame-runner.ts index fc6d9f4c829..abb71769d7a 100644 --- a/tools/client-plugins/browser-scripts/frame-runner.ts +++ b/tools/client-plugins/browser-scripts/frame-runner.ts @@ -11,13 +11,7 @@ frameDocument.__initTestFrame = initTestFrame; async function initTestFrame(e: InitTestFrameArg = { code: {} }) { const code = (e.code.contents || '').slice(); - const __file = (id?: string) => { - if (id && e.code.original) { - return e.code.original[id]; - } else { - return code; - } - }; + const editableContents = (e.code.editableContents || '').slice(); // __testEditable allows test authors to run tests against a transitory dom // element built using only the code in the editable region. diff --git a/tools/client-plugins/browser-scripts/index.d.ts b/tools/client-plugins/browser-scripts/index.d.ts index 4367d1b3561..44422b52cde 100644 --- a/tools/client-plugins/browser-scripts/index.d.ts +++ b/tools/client-plugins/browser-scripts/index.d.ts @@ -18,7 +18,6 @@ export interface InitTestFrameArg { code: { contents?: string; editableContents?: string; - original?: { [id: string]: string | null }; }; getUserInput?: (fileName: string) => string; loadEnzyme?: () => void; diff --git a/tools/client-plugins/browser-scripts/python-test-evaluator.ts b/tools/client-plugins/browser-scripts/python-test-evaluator.ts index 154f4d4a55c..f69c11c210e 100644 --- a/tools/client-plugins/browser-scripts/python-test-evaluator.ts +++ b/tools/client-plugins/browser-scripts/python-test-evaluator.ts @@ -16,7 +16,6 @@ interface PythonRunEvent extends MessageEvent { code: { contents: string; editableContents: string; - original: { [id: string]: string }; }; firstTest: unknown; testString: string; diff --git a/tools/client-plugins/browser-scripts/python-worker.ts b/tools/client-plugins/browser-scripts/python-worker.ts index e91b2804da9..acc03dbbfbf 100644 --- a/tools/client-plugins/browser-scripts/python-worker.ts +++ b/tools/client-plugins/browser-scripts/python-worker.ts @@ -21,7 +21,6 @@ interface PythonRunEvent extends MessageEvent { code: { contents: string; editableContents: string; - original: { [id: string]: string }; }; }; } diff --git a/tools/client-plugins/browser-scripts/test-evaluator.ts b/tools/client-plugins/browser-scripts/test-evaluator.ts index 3dd42108cc3..f4b4ba694e3 100644 --- a/tools/client-plugins/browser-scripts/test-evaluator.ts +++ b/tools/client-plugins/browser-scripts/test-evaluator.ts @@ -103,7 +103,6 @@ interface TestEvaluatorEvent extends MessageEvent { code: { contents: string; editableContents: string; - original: { [id: string]: string }; }; firstTest: unknown; testString: string;