Skip to content

Commit df66413

Browse files
committed
Touchups as per RichDom's review
1 parent 1e9584e commit df66413

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed

src/bundles/robot_minigame/helpers/tests.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,8 @@ export function run_tests({
1414
}) : boolean {
1515
// Run each test in order
1616
for (const test of tests) {
17-
// Store status in a variable
18-
let success: boolean;
19-
20-
switch(test.type) {
21-
case 'area':
22-
success = test.test(areaLog);
23-
break;
24-
default:
25-
success = true;
26-
}
27-
28-
// If the test fails, return false
29-
if (!success) return false;
17+
// Can replace with a switch statement when more success conditions appear
18+
if (test.type === 'area' && !test.test(areaLog)) return false;
3019
}
3120

3221
// If all tests pass, return true

src/tabs/RobotMaze/RobotSimulation.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ const ANIMATION_SPEED : number = 2;
123123
* React Component props for the Tab.
124124
*/
125125
interface MapProps {
126-
children?: never
127-
className?: never
128126
state: RobotMinigame,
129127
}
130128

src/tabs/RobotMaze/index.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import RobotSimulation from './RobotSimulation';
1212
* React Component props for the Tab.
1313
*/
1414
interface MainProps {
15-
children?: never
16-
className?: never
1715
context?: DebuggerContext
1816
}
1917

@@ -33,16 +31,14 @@ export default {
3331
* @param {DebuggerContext} context
3432
* @returns {boolean}
3533
*/
36-
toSpawn(context: DebuggerContext) {
37-
return context.context?.moduleContexts?.robot_minigame.state.isInit;
38-
},
34+
toSpawn: (context: DebuggerContext) => context.context?.moduleContexts?.robot_minigame.state.isInit,
3935

4036
/**
4137
* This function will be called to render the module tab in the side contents
4238
* on Source Academy frontend.
4339
* @param {DebuggerContext} context
4440
*/
45-
body: (context: any) => <RobotMaze context={context} />,
41+
body: (context: DebuggerContext) => <RobotMaze context={context} />,
4642

4743
/**
4844
* The Tab's icon tooltip in the side contents on Source Academy frontend.

0 commit comments

Comments
 (0)