-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: parse checkboxes * fixup! feat: parse checkboxes * docs: Update readme to match v3 behaviour * fix: ensure every value sets an output parameter * chore: update readme Co-authored-by: Stefan Buck <[email protected]>
- Loading branch information
1 parent
4e72cf0
commit 0aa2386
Showing
6 changed files
with
122 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,27 +34,21 @@ it("readme example", () => { | |
|
||
// mock core | ||
const core = { | ||
getInput(inputName) { | ||
expect(inputName).toBe("template-path"); | ||
return "<template-path>"; | ||
}, | ||
setOutput(outputName, outputValue) { | ||
if (outputName === "jsonString") { | ||
expect(outputValue).toBe(expectedOutputJson); | ||
return; | ||
} | ||
|
||
if (outputName.startsWith("issueparser_")) { | ||
const key = outputName.substr("issueparser_".length); | ||
expect(Object.keys(expectedOutput)).toContain(key); | ||
|
||
expect(outputValue).toBe(expectedOutput[key]); | ||
return; | ||
} | ||
}, | ||
getInput: jest.fn(() => '<template-path>'), | ||
setOutput: jest.fn(), | ||
}; | ||
|
||
run(env, eventPayload, fs, core); | ||
expect(core.getInput).toHaveBeenCalledWith('template-path') | ||
expect(core.setOutput).toHaveBeenCalledWith('jsonString', JSON.stringify(expectedOutput, null, 2)) | ||
expect(core.setOutput).toHaveBeenCalledWith('issueparser_contact', '[email protected]') | ||
expect(core.setOutput).toHaveBeenCalledWith('issueparser_what_happened', 'A bug happened!') | ||
expect(core.setOutput).toHaveBeenCalledWith('issueparser_version', '1.0.0') | ||
expect(core.setOutput).toHaveBeenCalledWith('issueparser_browsers', 'Chrome, Safari') | ||
expect(core.setOutput).toHaveBeenCalledWith('issueparser_anything_else', 'Never give up') | ||
expect(core.setOutput).toHaveBeenCalledWith('issueparser_second_anything_else', 'Hot Dog is a Sandwich,Another item') | ||
expect(core.setOutput).toHaveBeenCalledWith('issueparser_checkbox_without_an_id', '') | ||
expect(core.setOutput.mock.calls.length).toBe(8) | ||
}); | ||
|
||
it("multiple paragraphs", () => { | ||
|
@@ -84,27 +78,17 @@ it("multiple paragraphs", () => { | |
|
||
// mock core | ||
const core = { | ||
getInput(inputName) { | ||
expect(inputName).toBe("template-path"); | ||
return "<template-path>"; | ||
}, | ||
setOutput(outputName, outputValue) { | ||
if (outputName === "jsonString") { | ||
expect(outputValue).toBe(expectedOutputJson); | ||
return; | ||
} | ||
|
||
if (outputName.startsWith("issueparser_")) { | ||
const key = outputName.substr("issueparser_".length); | ||
expect(Object.keys(expectedOutput)).toContain(key); | ||
|
||
expect(outputValue).toBe(expectedOutput[key]); | ||
return; | ||
} | ||
}, | ||
getInput: jest.fn(() => '<template-path>'), | ||
setOutput: jest.fn(), | ||
}; | ||
|
||
run(env, eventPayload, fs, core); | ||
|
||
expect(core.getInput).toHaveBeenCalledWith('template-path') | ||
expect(core.setOutput).toHaveBeenCalledWith('jsonString', JSON.stringify(expectedOutput, null, 2)) | ||
expect(core.setOutput).toHaveBeenCalledWith('issueparser_textarea-one', '1st paragraph\n\n2nd paragraph') | ||
expect(core.setOutput).toHaveBeenCalledWith('issueparser_textarea-two', '1st paragraph\n2nd paragraph') | ||
expect(core.setOutput.mock.calls.length).toBe(3) | ||
}); | ||
|
||
it("blank", () => { | ||
|