mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(api): rename account delete endpoint (#50485)
This commit is contained in:
+1
-1
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -10,8 +10,8 @@ export const userRoutes: FastifyPluginCallbackTypebox = (
|
||||
) => {
|
||||
fastify.addHook('onRequest', fastify.authenticateSession);
|
||||
|
||||
fastify.delete(
|
||||
'/account',
|
||||
fastify.post(
|
||||
'/account/delete',
|
||||
{
|
||||
schema: {
|
||||
response: {
|
||||
|
||||
Reference in New Issue
Block a user