We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 30578d3 commit 69c787cCopy full SHA for 69c787c
tests/pin.test.js
@@ -179,4 +179,24 @@ describe("Test /api/pin", () => {
179
renderError("Something went wrong", "Language not found"),
180
);
181
});
182
+
183
+ it("should render error card if missing required parameters", async () => {
184
+ const req = {
185
+ query: {},
186
+ };
187
+ const res = {
188
+ setHeader: jest.fn(),
189
+ send: jest.fn(),
190
191
192
+ await pin(req, res);
193
194
+ expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
195
+ expect(res.send).toBeCalledWith(
196
+ renderError(
197
+ 'Missing params "username", "repo" make sure you pass the parameters in URL',
198
+ "/api/pin?username=USERNAME&repo=REPO_NAME",
199
+ ),
200
+ );
201
+ });
202
0 commit comments