fix(api): rename account delete endpoint (#50485)

This commit is contained in:
Niraj Nandish
2023-05-24 08:37:29 +04:00
committed by GitHub
parent dd6ea2e144
commit 94534382ae
3 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -166,7 +166,7 @@ export const build = async (
void fastify.register(devLoginCallback, { prefix: '/auth' });
}
void fastify.register(settingRoutes);
void fastify.register(userRoutes, { prefix: '/user' });
void fastify.register(userRoutes);
void fastify.register(deprecatedEndpoints);
return fastify;
+8 -8
View File
@@ -15,10 +15,10 @@ describe('userRoutes', () => {
setCookies = res.get('Set-Cookie');
});
describe('/account', () => {
test('DELETE returns 200 status code with empty object', async () => {
const response = await superRequest('/user/account', {
method: 'DELETE',
describe('/account/delete', () => {
test('POST returns 200 status code with empty object', async () => {
const response = await superRequest('/account/delete', {
method: 'POST',
setCookies
});
@@ -35,10 +35,10 @@ describe('userRoutes', () => {
describe('Unauthenticated user', () => {
// TODO: get CSRF cookies when that PR is in.
describe('/account', () => {
test('DELETE returns 401 status code with error message', async () => {
const response = await superRequest('/user/account', {
method: 'DELETE'
describe('/account/delete', () => {
test('POST returns 401 status code with error message', async () => {
const response = await superRequest('/account/delete', {
method: 'POST'
});
expect(response?.statusCode).toBe(401);
+2 -2
View File
@@ -10,8 +10,8 @@ export const userRoutes: FastifyPluginCallbackTypebox = (
) => {
fastify.addHook('onRequest', fastify.authenticateSession);
fastify.delete(
'/account',
fastify.post(
'/account/delete',
{
schema: {
response: {