Skip to content

Commit 4c1d1d7

Browse files
authored
fix: Revert "test: set RUNNER_TEMP instead of HOME" (#75)
This reverts commit 3c890f0.
1 parent 3c890f0 commit 4c1d1d7

File tree

1 file changed

+35
-95
lines changed

1 file changed

+35
-95
lines changed

test.spec.js

Lines changed: 35 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,16 @@ it("readme example", () => {
3434

3535
// mock core
3636
const core = {
37-
getInput: jest.fn(() => "<template-path>"),
37+
getInput: jest.fn(() => '<template-path>'),
3838
setOutput: jest.fn(),
3939
};
4040

4141
run(env, eventPayload, fs, core);
42-
expect(core.getInput).toHaveBeenCalledWith("template-path");
43-
expect(core.setOutput).toHaveBeenCalledWith(
44-
"jsonString",
45-
JSON.stringify(expectedOutput, null, 2)
46-
);
47-
expect(core.setOutput).toHaveBeenCalledWith(
48-
"issueparser_favorite_dish",
49-
"Pizza"
50-
);
51-
expect(core.setOutput).toHaveBeenCalledWith(
52-
"issueparser_favorite_color",
53-
"Red,Blue"
54-
);
55-
expect(core.setOutput.mock.calls.length).toBe(3);
42+
expect(core.getInput).toHaveBeenCalledWith('template-path')
43+
expect(core.setOutput).toHaveBeenCalledWith('jsonString', JSON.stringify(expectedOutput, null, 2))
44+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_favorite_dish', 'Pizza')
45+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_favorite_color', 'Red,Blue')
46+
expect(core.setOutput.mock.calls.length).toBe(3)
5647
});
5748

5849
it("full example", () => {
@@ -82,42 +73,21 @@ it("full example", () => {
8273

8374
// mock core
8475
const core = {
85-
getInput: jest.fn(() => "<template-path>"),
76+
getInput: jest.fn(() => '<template-path>'),
8677
setOutput: jest.fn(),
8778
};
8879

8980
run(env, eventPayload, fs, core);
90-
expect(core.getInput).toHaveBeenCalledWith("template-path");
91-
expect(core.setOutput).toHaveBeenCalledWith(
92-
"jsonString",
93-
JSON.stringify(expectedOutput, null, 2)
94-
);
95-
expect(core.setOutput).toHaveBeenCalledWith(
96-
"issueparser_contact",
97-
"me@me.com"
98-
);
99-
expect(core.setOutput).toHaveBeenCalledWith(
100-
"issueparser_what_happened",
101-
"A bug happened!"
102-
);
103-
expect(core.setOutput).toHaveBeenCalledWith("issueparser_version", "1.0.0");
104-
expect(core.setOutput).toHaveBeenCalledWith(
105-
"issueparser_browsers",
106-
"Chrome, Safari"
107-
);
108-
expect(core.setOutput).toHaveBeenCalledWith(
109-
"issueparser_anything_else",
110-
"Never give up"
111-
);
112-
expect(core.setOutput).toHaveBeenCalledWith(
113-
"issueparser_second_anything_else",
114-
"Hot Dog is a Sandwich,Another item"
115-
);
116-
expect(core.setOutput).toHaveBeenCalledWith(
117-
"issueparser_checkbox_without_an_id",
118-
""
119-
);
120-
expect(core.setOutput.mock.calls.length).toBe(8);
81+
expect(core.getInput).toHaveBeenCalledWith('template-path')
82+
expect(core.setOutput).toHaveBeenCalledWith('jsonString', JSON.stringify(expectedOutput, null, 2))
83+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_contact', 'me@me.com')
84+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_what_happened', 'A bug happened!')
85+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_version', '1.0.0')
86+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_browsers', 'Chrome, Safari')
87+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_anything_else', 'Never give up')
88+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_second_anything_else', 'Hot Dog is a Sandwich,Another item')
89+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_checkbox_without_an_id', '')
90+
expect(core.setOutput.mock.calls.length).toBe(8)
12191
});
12292

12393
it("mismatched parsing", () => {
@@ -126,7 +96,7 @@ it("mismatched parsing", () => {
12696

12797
// mock ENV
12898
const env = {
129-
RUNNER_TEMP: "<home path>",
99+
HOME: "<home path>",
130100
};
131101

132102
// mock event payload
@@ -147,42 +117,21 @@ it("mismatched parsing", () => {
147117

148118
// mock core
149119
const core = {
150-
getInput: jest.fn(() => "<template-path>"),
120+
getInput: jest.fn(() => '<template-path>'),
151121
setOutput: jest.fn(),
152122
};
153123

154124
run(env, eventPayload, fs, core);
155-
expect(core.getInput).toHaveBeenCalledWith("template-path");
156-
expect(core.setOutput).toHaveBeenCalledWith(
157-
"jsonString",
158-
JSON.stringify(expectedOutput, null, 2)
159-
);
160-
expect(core.setOutput).toHaveBeenCalledWith(
161-
"issueparser_your_contact_details",
162-
"me@me.com"
163-
);
164-
expect(core.setOutput).toHaveBeenCalledWith(
165-
"issueparser_what_happened",
166-
"A bug happened!"
167-
);
168-
expect(core.setOutput).toHaveBeenCalledWith("issueparser_version", "1.0.0");
169-
expect(core.setOutput).toHaveBeenCalledWith(
170-
"issueparser_what_browsers_are_you_seeing_the_problem_on",
171-
"Chrome, Safari"
172-
);
173-
expect(core.setOutput).toHaveBeenCalledWith(
174-
"issueparser_what_else",
175-
"Never give up"
176-
);
177-
expect(core.setOutput).toHaveBeenCalledWith(
178-
"issueparser_and_with_that",
179-
"Hot Dog is a Sandwich,Another item"
180-
);
181-
expect(core.setOutput).toHaveBeenCalledWith(
182-
"issueparser_checkbox_without_an_id",
183-
""
184-
);
185-
expect(core.setOutput.mock.calls.length).toBe(8);
125+
expect(core.getInput).toHaveBeenCalledWith('template-path')
126+
expect(core.setOutput).toHaveBeenCalledWith('jsonString', JSON.stringify(expectedOutput, null, 2))
127+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_your_contact_details', 'me@me.com')
128+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_what_happened', 'A bug happened!')
129+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_version', '1.0.0')
130+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_what_browsers_are_you_seeing_the_problem_on', 'Chrome, Safari')
131+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_what_else', 'Never give up')
132+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_and_with_that', 'Hot Dog is a Sandwich,Another item')
133+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_checkbox_without_an_id', '')
134+
expect(core.setOutput.mock.calls.length).toBe(8)
186135
});
187136

188137
it("multiple paragraphs", () => {
@@ -212,26 +161,17 @@ it("multiple paragraphs", () => {
212161

213162
// mock core
214163
const core = {
215-
getInput: jest.fn(() => "<template-path>"),
164+
getInput: jest.fn(() => '<template-path>'),
216165
setOutput: jest.fn(),
217166
};
218167

219168
run(env, eventPayload, fs, core);
220169

221-
expect(core.getInput).toHaveBeenCalledWith("template-path");
222-
expect(core.setOutput).toHaveBeenCalledWith(
223-
"jsonString",
224-
JSON.stringify(expectedOutput, null, 2)
225-
);
226-
expect(core.setOutput).toHaveBeenCalledWith(
227-
"issueparser_textarea-one",
228-
"1st paragraph\n\n2nd paragraph"
229-
);
230-
expect(core.setOutput).toHaveBeenCalledWith(
231-
"issueparser_textarea-two",
232-
"1st paragraph\n2nd paragraph"
233-
);
234-
expect(core.setOutput.mock.calls.length).toBe(3);
170+
expect(core.getInput).toHaveBeenCalledWith('template-path')
171+
expect(core.setOutput).toHaveBeenCalledWith('jsonString', JSON.stringify(expectedOutput, null, 2))
172+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_textarea-one', '1st paragraph\n\n2nd paragraph')
173+
expect(core.setOutput).toHaveBeenCalledWith('issueparser_textarea-two', '1st paragraph\n2nd paragraph')
174+
expect(core.setOutput.mock.calls.length).toBe(3)
235175
});
236176

237177
it("blank", () => {

0 commit comments

Comments
 (0)