Skip to content

Commit

Permalink
Fix: get_output_value without a successful previous run. (#334)
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock authored Jun 12, 2024
1 parent ed05f56 commit 6601633
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/src/tester/StoryOutputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export class StoryOutputs {
}

get_output_value (chapter_id: string, output_name: string): any {
return this.outputs[chapter_id].get_output(output_name)
const output = this.outputs[chapter_id]
return output !== undefined ? output.get_output(output_name) : undefined
}

resolve_params (parameters: Record<string, Parameter>): Record<string, Parameter> {
Expand Down
1 change: 1 addition & 0 deletions tools/tests/tester/story_outputs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const story_outputs = new StoryOutputs({

test('resolve_string', () => {
expect(story_outputs.resolve_string('${chapter_id.x}')).toEqual(1)
expect(story_outputs.resolve_string('${invalid_id.x}')).toBeUndefined()
expect(story_outputs.resolve_string('some_str')).toEqual('some_str')
})

Expand Down

0 comments on commit 6601633

Please sign in to comment.