Skip to content

Commit f19a3bd

Browse files
committed
Refactor error messages for consistency and clarity in core functionality and tests
1 parent 0ce6a38 commit f19a3bd

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const requestHandler = (request, response) => {
3636
if (request.method && request.method !== 'POST') {
3737
debug(MESSAGES.ONLY_POST_SUPPORTED);
3838
return Promise.reject({
39-
body: `Only POST call is supported.`,
39+
body: `Only POST requests are supported.`,
4040
statusCode: 400,
4141
statusMessage: 'Not allowed',
4242
});

test/unit/index.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ describe("Test start method without user config.", () => {
101101
.then(response => {
102102
expect(response.statusCode).toBe(400);
103103
expect(response.body.error.message).toBe(
104-
"Only POST call is supported.",
104+
"Only POST requests are supported.",
105105
);
106106
});
107107
});
@@ -147,7 +147,7 @@ describe("Test start method with custom logger", () => {
147147
});
148148
});
149149

150-
describe("Test start method with invalid user config", async () => {
150+
describe("Test start method with invalid user config", () => {
151151
test("It should throw error when endpoint in config set to number", () => {
152152
let config;
153153
register(notify);
@@ -160,7 +160,7 @@ describe("Test start method with invalid user config", async () => {
160160
start(config)
161161
.then(svr => {})
162162
.catch(error => {
163-
expect(error.message).toBe("Please provide valide listener.endpoint");
163+
expect(error.message).toBe("Please provide a valid listener endpoint.");
164164
});
165165
});
166166

@@ -176,7 +176,7 @@ describe("Test start method with invalid user config", async () => {
176176
start(config)
177177
.then(svr => {})
178178
.catch(error => {
179-
expect(error.message).toBe("Please provide valide listener.port");
179+
expect(error.message).toBe("Please provide a valid listener port.");
180180
});
181181
});
182182
});
@@ -223,7 +223,7 @@ describe("Test start method with user config", () => {
223223
.then(response => {
224224
expect(response.statusCode).toBe(400);
225225
expect(response.body.error.message).toBe(
226-
"Only POST call is supported.",
226+
"Only POST requests are supported.",
227227
);
228228
});
229229
});

0 commit comments

Comments
 (0)