Skip to content

Commit d791484

Browse files
author
patched.codes[bot]
committed
Patched /tmp/tmpptoa8sbv/custom/test/hello/v1/test.js
1 parent 0331454 commit d791484

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

custom/test/hello/v1/test.js

+35
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,17 @@ import { sep } from 'path';
55
const version = __dirname.split(sep).reverse()[0];
66
const endpoint = `${version}/hello`;
77

8+
/**
9+
* Test suite for the 'hello' endpoint
10+
* @param {string} endpoint - The base URL of the hello endpoint
11+
* @returns {void} No return value
12+
*/
813
describe('hello:', () => {
14+
/**
15+
* Tests the GET request to the specified endpoint with a missing "name" query parameter
16+
* @param {string} endpoint - The API endpoint being tested
17+
* @returns {void} This test function doesn't return a value
18+
*/
919
it(`GET ${endpoint} - missing "name" query parameter - returns 400`, async () => {
1020
const res = await request({
1121
method: 'GET',
@@ -15,6 +25,11 @@ describe('hello:', () => {
1525
expect(res.result.error).to.equal('"name" is required');
1626
});
1727

28+
/**
29+
* Tests the GET request to the specified endpoint with a "name" query parameter
30+
* @param {string} endpoint - The API endpoint to be tested
31+
* @returns {void} This test function doesn't return a value
32+
*/
1833
it(`GET ${endpoint} - with "name" query parmeter - returns 200`, async () => {
1934
const res = await request({
2035
method: 'GET',
@@ -24,6 +39,11 @@ describe('hello:', () => {
2439
expect(res.result).to.toMatchObject({ hello: 'world' });
2540
});
2641

42+
/**
43+
* Tests the GET request to {endpoint}/{name} for a 200 status code and correct response body
44+
* @param {string} endpoint - The base endpoint URL for the API
45+
* @returns {void} This test function does not return a value
46+
*/
2747
it(`GET ${endpoint}/{name} - returns 200`, async () => {
2848
const res = await request({
2949
method: 'GET',
@@ -33,6 +53,11 @@ describe('hello:', () => {
3353
expect(res.result).to.toMatchObject({ hello: 'world' });
3454
});
3555

56+
/**
57+
* Tests the POST request to the specified endpoint
58+
* @param {string} endpoint - The API endpoint to be tested
59+
* @returns {void} This test function doesn't return a value
60+
*/
3661
it(`POST ${endpoint} - returns 201`, async () => {
3762
const res = await request({
3863
method: 'POST',
@@ -46,6 +71,11 @@ describe('hello:', () => {
4671
expect(res.result).to.toMatchObject({ hello: 'world' });
4772
});
4873

74+
/**
75+
* Tests the PUT request to the specified endpoint with a name parameter
76+
* @param {string} endpoint - The base endpoint for the API
77+
* @returns {void} No return value
78+
*/
4979
it(`PUT ${endpoint}/{name} - returns 200`, async () => {
5080
const res = await request({
5181
method: 'PUT',
@@ -58,6 +88,11 @@ describe('hello:', () => {
5888
expect(res.result).to.toMatchObject({ hello: 'world', comment: 'hello' });
5989
});
6090

91+
/**
92+
* Tests the DELETE endpoint for a specific name
93+
* @param {string} endpoint - The base endpoint URL
94+
* @returns {void} No return value
95+
*/
6196
it(`DELETE ${endpoint}/{name} - returns 200`, async () => {
6297
const res = await request({
6398
method: 'DELETE',

0 commit comments

Comments
 (0)