Skip to content

Commit

Permalink
refactor: form feedback tests to merge into one describe route
Browse files Browse the repository at this point in the history
  • Loading branch information
hanstirtaputra committed Jun 28, 2022
1 parent a520f8f commit 0572f77
Showing 1 changed file with 4 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ import { PublicFormsRouter } from '../public-forms.routes'

const app = setupApp('/forms', PublicFormsRouter)

/**
* TODO #3964: Remove 'public-form.feedback.routes' test, and keep 'public-form.submissions.feedback.routes' test
* once `/api/v3/forms/{formId}/feedback` route is cleaned up
*/
describe('public-form.feedback.routes', () => {
let request: Session

Expand All @@ -34,6 +30,10 @@ describe('public-form.feedback.routes', () => {
jest.restoreAllMocks()
})
afterAll(async () => await dbHandler.closeDatabase())
/**
* TODO #3964: Remove /forms/:formId/feedback tests, and keep '/forms/:formId/submissions/:submissionId/feedback'
* test once `/api/v3/forms/{formId}/feedback` route is cleaned up
*/
describe('POST /forms/:formId/feedback', () => {
it('should return 200 when feedback was successfully saved', async () => {
// Arrange
Expand Down Expand Up @@ -165,24 +165,7 @@ describe('public-form.feedback.routes', () => {
expect(response.body).toEqual(expectedResponse)
})
})
})

/**
* TODO #3964: Update the `describe` path from 'public-form.submissions.feedback.routes'
* to 'public-form.feedback.routes' once `/api/v3/forms/{formId}/feedback` route is cleaned up
*/
describe('public-form.submissions.feedback.routes', () => {
let request: Session

beforeAll(async () => await dbHandler.connect())
beforeEach(async () => {
request = supertest(app)
})
afterEach(async () => {
await dbHandler.clearDatabase()
jest.restoreAllMocks()
})
afterAll(async () => await dbHandler.closeDatabase())
describe('POST /forms/:formId/submissions/:submissionId/feedback', () => {
it('should return 200 when feedback was successfully saved', async () => {
const MOCK_FEEDBACK = {
Expand Down

0 comments on commit 0572f77

Please sign in to comment.