File tree Expand file tree Collapse file tree 10 files changed +5
-25
lines changed
client/src/templates/Challenges
tools/client-plugins/browser-scripts Expand file tree Collapse file tree 10 files changed +5
-25
lines changed Original file line number Diff line number Diff line change @@ -341,8 +341,7 @@ function* updatePython(challengeData) {
341341 interruptCodeExecution ( ) ;
342342 const code = {
343343 contents : buildData . sources . index ,
344- editableContents : buildData . sources . editableContents ,
345- original : buildData . sources . original
344+ editableContents : buildData . sources . editableContents
346345 } ;
347346
348347 runPythonCode ( code ) ;
Original file line number Diff line number Diff line change @@ -74,22 +74,18 @@ const applyFunction =
7474const composeFunctions = ( ...fns : ApplyFunctionProps [ ] ) =>
7575 fns . map ( applyFunction ) . reduce ( ( f , g ) => x => f ( x ) . then ( g ) ) ;
7676
77- // TODO: split this into at least two functions. One to create 'original' i.e.
78- // the source and another to create the contents.
7977function buildSourceMap ( challengeFiles : ChallengeFile [ ] ) : Source | undefined {
8078 // TODO: rename sources.index to sources.contents.
8179 const source : Source | undefined = challengeFiles ?. reduce (
8280 ( sources , challengeFile ) => {
8381 sources . index += challengeFile . source || '' ;
8482 sources . contents = sources . index ;
85- sources . original [ challengeFile . history [ 0 ] ] = challengeFile . source ?? null ;
8683 sources . editableContents += challengeFile . editableContents || '' ;
8784 return sources ;
8885 } ,
8986 {
9087 index : '' ,
91- editableContents : '' ,
92- original : { }
88+ editableContents : ''
9389 } as Source
9490 ) ;
9591 return source ;
@@ -181,8 +177,7 @@ function getWorkerTestRunner(
181177) {
182178 const code = {
183179 contents : sources . index ,
184- editableContents : sources . editableContents ,
185- original : sources . original
180+ editableContents : sources . editableContents
186181 } ;
187182
188183 interface TestWorkerExecutor extends WorkerExecutor {
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ export interface Source {
1313 index : string ;
1414 contents ?: string ;
1515 editableContents : string ;
16- original : { [ key : string ] : string | null } ;
1716}
1817
1918interface Hooks {
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ let listener: ((event: MessageEvent) => void) | null = null;
88type Code = {
99 contents : string ;
1010 editableContents : string ;
11- original : string ;
1211} ;
1312// We need to keep track of the last code message so we can re-run it if the
1413// worker is reset.
@@ -102,7 +101,6 @@ export function interruptCodeExecution(): void {
102101export function runPythonCode ( code : {
103102 contents : string ;
104103 editableContents : string ;
105- original : string ;
106104} ) : void {
107105 lastCodeMessage = code ;
108106 getPythonWorker ( ) . postMessage ( { type : 'run' , code } ) ;
Original file line number Diff line number Diff line change @@ -570,8 +570,7 @@ async function createTestRunner(
570570
571571 const code = {
572572 contents : sources . index ,
573- editableContents : sources . editableContents ,
574- original : sources . original
573+ editableContents : sources . editableContents
575574 } ;
576575
577576 const buildFunction = buildFunctions [ challenge . challengeType ] ;
Original file line number Diff line number Diff line change @@ -11,13 +11,7 @@ frameDocument.__initTestFrame = initTestFrame;
1111
1212async function initTestFrame ( e : InitTestFrameArg = { code : { } } ) {
1313 const code = ( e . code . contents || '' ) . slice ( ) ;
14- const __file = ( id ?: string ) => {
15- if ( id && e . code . original ) {
16- return e . code . original [ id ] ;
17- } else {
18- return code ;
19- }
20- } ;
14+
2115 const editableContents = ( e . code . editableContents || '' ) . slice ( ) ;
2216 // __testEditable allows test authors to run tests against a transitory dom
2317 // element built using only the code in the editable region.
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ export interface InitTestFrameArg {
1818 code : {
1919 contents ?: string ;
2020 editableContents ?: string ;
21- original ?: { [ id : string ] : string | null } ;
2221 } ;
2322 getUserInput ?: ( fileName : string ) => string ;
2423 loadEnzyme ?: ( ) => void ;
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ interface PythonRunEvent extends MessageEvent {
1616 code : {
1717 contents : string ;
1818 editableContents : string ;
19- original : { [ id : string ] : string } ;
2019 } ;
2120 firstTest : unknown ;
2221 testString : string ;
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ interface PythonRunEvent extends MessageEvent {
2121 code : {
2222 contents : string ;
2323 editableContents : string ;
24- original : { [ id : string ] : string } ;
2524 } ;
2625 } ;
2726}
Original file line number Diff line number Diff line change @@ -103,7 +103,6 @@ interface TestEvaluatorEvent extends MessageEvent {
103103 code : {
104104 contents : string ;
105105 editableContents : string ;
106- original : { [ id : string ] : string } ;
107106 } ;
108107 firstTest : unknown ;
109108 testString : string ;
You can’t perform that action at this time.
0 commit comments