Skip to content

Commit fa9789c

Browse files
committed
♻️ Change /api/users to /api/user
1 parent d706841 commit fa9789c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/app/components/user/user.route.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import { hasBody } from './user.middleware';
22
import { save } from './user.controller';
33

44
export default (server, prefix) => {
5-
server.post(`${prefix}/users`, hasBody, save);
5+
server.post(`${prefix}/user`, hasBody, save);
66
};

test/app/components/user/user.controller.test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ import { UserBuilder } from '../../../data-builders';
77

88
const prefix = '/api';
99

10-
describe(`${prefix}/users`, () => {
10+
describe(`${prefix}/user`, () => {
1111
before(() => User.deleteMany());
1212
after(() => User.deleteMany());
1313

1414
describe('POST /', () => {
1515
it("should return 400 when the body doesn't have name, email and password", async () => {
16-
const { status } = await request(server).post(`${prefix}/users`);
16+
const { status } = await request(server).post(`${prefix}/user`);
1717

1818
expect(status).to.equals(400);
1919
});
2020

2121
it("should return an array with keys field and error when the body doesn't have name, email and password", async () => {
22-
const { body } = await request(server).post(`${prefix}/users`);
22+
const { body } = await request(server).post(`${prefix}/user`);
2323

2424
expect(body).to.be.an('array');
2525
expect(body.length).to.equal(3);
@@ -36,7 +36,7 @@ describe(`${prefix}/users`, () => {
3636
const nameInvalid = UserBuilder.nameInvalid();
3737

3838
const { body } = await request(server)
39-
.post(`${prefix}/users`)
39+
.post(`${prefix}/user`)
4040
.send({ ...newUser, ...nameInvalid });
4141

4242
const errorName = () => body.find(error => error.field === 'name');
@@ -49,7 +49,7 @@ describe(`${prefix}/users`, () => {
4949
const emailInvalid = UserBuilder.emailInvalid();
5050

5151
const { body } = await request(server)
52-
.post(`${prefix}/users`)
52+
.post(`${prefix}/user`)
5353
.send(emailInvalid);
5454

5555
const errorEmail = () => body.find(error => error.field === 'email');
@@ -62,11 +62,11 @@ describe(`${prefix}/users`, () => {
6262
const newUser = UserBuilder.randomUserInfo();
6363

6464
await request(server)
65-
.post(`${prefix}/users`)
65+
.post(`${prefix}/user`)
6666
.send(newUser);
6767

6868
const { status, body } = await request(server)
69-
.post(`${prefix}/users`)
69+
.post(`${prefix}/user`)
7070
.send(newUser);
7171

7272
const errorEmail = () => body.find(error => error.field === 'email');
@@ -79,7 +79,7 @@ describe(`${prefix}/users`, () => {
7979
const passwordInvalid = UserBuilder.passwordInvalid();
8080

8181
const { body } = await request(server)
82-
.post(`${prefix}/users`)
82+
.post(`${prefix}/user`)
8383
.send(passwordInvalid);
8484

8585
const errorPassword = () =>
@@ -93,7 +93,7 @@ describe(`${prefix}/users`, () => {
9393
const newUser = UserBuilder.randomUserInfo();
9494

9595
const { status, body } = await request(server)
96-
.post(`${prefix}/users`)
96+
.post(`${prefix}/user`)
9797
.send(newUser);
9898

9999
expect(status).to.equal(201);

0 commit comments

Comments
 (0)