Repository: freeCodeCamp/freeCodeCamp
File: api/src/routes/settings.test.ts (TypeScript)

Code before:
          .send({ sendQuincyEmail: true });

        expect(response?.statusCode).toEqual(200);

        expect(response?.body).toEqual({
          message: 'flash.subscribe-to-quincy-updated',
          type: 'success'
        });
      });

      test('PUT returns 400 status code with invalid sendQuincyEmail', async () => {
        const response = await request(fastify?.server)
          .put('/update-my-quincy-email')
          .set('Cookie', cookies)
          .send({ sendQuincyEmail: 'invalid' });

        expect(response?.statusCode).toEqual(400);
      });
    });

    describe('/update-my-honesty', () => {
      test('PUT returns 200 status code with "success" message', async () => {
        const response = await request(fastify?.server)
          .put('/update-my-honesty')
          .set('Cookie', cookies)
          .send({ honesty: true });

        expect(response?.statusCode).toEqual(200);

        expect(response?.body).toEqual({
          type: 'success'
        });
      });

      test('PUT returns 400 status code with invalid honesty', async () => {
        const response = await request(fastify?.server)
          .put('/update-my-honesty')
          .set('Cookie', cookies)
          .send({ honesty: 'invalid' });

        expect(response?.statusCode).toEqual(400);
      });
    });
  });

  describe('Unauthenticated User', () => {
    test('PUT /update-my-profileui returns 401 status code for un-authenticated users', async () => {
      const response = await request(fastify?.server).put(
        '/update-my-profileui'
      );


Review comment (suggestion):
```suggestion
          .send({ isHonest: true });
```

Code after:
          .send({ sendQuincyEmail: true });

        expect(response?.statusCode).toEqual(200);

        expect(response?.body).toEqual({
          message: 'flash.subscribe-to-quincy-updated',
          type: 'success'
        });
      });

      test('PUT returns 400 status code with invalid sendQuincyEmail', async () => {
        const response = await request(fastify?.server)
          .put('/update-my-quincy-email')
          .set('Cookie', cookies)
          .send({ sendQuincyEmail: 'invalid' });

        expect(response?.statusCode).toEqual(400);
      });
    });

    describe('/update-my-honesty', () => {
      test('PUT returns 200 status code with "success" message', async () => {
        const response = await request(fastify?.server)
          .put('/update-my-honesty')
          .set('Cookie', cookies)
          .send({ isHonest: true });

        expect(response?.statusCode).toEqual(200);

        expect(response?.body).toEqual({
          message: 'buttons.accepted-honesty',
          type: 'success'
        });
      });

      test('PUT returns 400 status code with invalid honesty', async () => {
        const response = await request(fastify?.server)
          .put('/update-my-honesty')
          .set('Cookie', cookies)
          .send({ isHonest: false });

        expect(response?.statusCode).toEqual(400);
      });
    });
  });

  describe('Unauthenticated User', () => {
    test('PUT /update-my-profileui returns 401 status code for un-authenticated users', async () => {
      const response = await request(fastify?.server).put(
        '/update-my-profileui'
      );