Skip to content

Commit 9eaa01f

Browse files
committed
state machine test progress
1 parent 78e1467 commit 9eaa01f

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

src/state/actions/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export default {
8989
vscode.commands.executeCommand('coderoad.run_test')
9090
},
9191
testPass() {
92-
vscode.window.showWarningMessage('FAIL')
92+
vscode.window.showInformationMessage('PASS')
9393
},
9494
testFail() {
9595
vscode.window.showWarningMessage('FAIL')
@@ -148,4 +148,7 @@ export default {
148148
return nextProgress
149149
}
150150
}),
151+
stepLoadNext() {
152+
console.log("LOAD NEXT STEP")
153+
}
151154
}

src/state/machine.ts

+16-12
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const machine = Machine<
5050
ContinueTutorial: {
5151
onEntry: ['tutorialContinue'],
5252
on: {
53-
TUTORIAL_START: '#tutorial-load-next'
53+
TUTORIAL_START: '#tutorial-load-next-stage'
5454
}
5555
},
5656
}
@@ -60,8 +60,8 @@ export const machine = Machine<
6060
initial: 'Summary',
6161
onEntry: ['tutorialSetup'],
6262
states: {
63-
LoadNext: {
64-
id: 'tutorial-load-next',
63+
LoadNextStage: {
64+
id: 'tutorial-load-next-stage',
6565
onEntry: ['tutorialLoadNext'],
6666
on: {
6767
LOAD_NEXT: [
@@ -117,16 +117,14 @@ export const machine = Machine<
117117
},
118118
TestPass: {
119119
onEntry: ['testPass', 'stepComplete'],
120+
after: {
121+
0: {
122+
target: 'StepNext',
123+
cond: 'hasNextStep',
124+
}
125+
},
120126
on: {
121-
NEXT: [
122-
{
123-
target: 'StageNormal',
124-
cond: 'hasNextStep',
125-
},
126-
{
127-
target: 'StageComplete',
128-
},
129-
],
127+
NEXT: 'StageComplete',
130128
},
131129
},
132130
TestFail: {
@@ -135,6 +133,12 @@ export const machine = Machine<
135133
0: 'StageNormal'
136134
},
137135
},
136+
StepNext: {
137+
onEntry: ['stepLoadNext'],
138+
after: {
139+
0: 'StageNormal'
140+
}
141+
},
138142
StageComplete: {
139143
onEntry: 'stageComplete',
140144
on: {

typings/index.d.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export interface MachineStateSchema {
146146
}
147147
Tutorial: {
148148
states: {
149-
LoadNext: {}
149+
LoadNextStage: {}
150150
Summary: {}
151151
Level: {}
152152
Stage: {
@@ -155,6 +155,7 @@ export interface MachineStateSchema {
155155
TestRunning: {}
156156
TestPass: {}
157157
TestFail: {}
158+
StepNext: {}
158159
StageComplete: {}
159160
}
160161
}

0 commit comments

Comments
 (0)