-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: convert CsvMergedHeadersGenerator to typescript #2080
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should type getResponseInstance
as part of this as well, wdyt?
src/public/modules/forms/helpers/csv-response-classes/Response.class.ts
Outdated
Show resolved
Hide resolved
src/public/modules/forms/helpers/csv-response-classes/TableResponse.class.ts
Outdated
Show resolved
Hide resolved
src/public/modules/forms/helpers/csv-response-classes/SingleAnswerResponse.class.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pinging @karrui for another pair of eyes
tests/unit/frontend/forms/helpers/CsvMergedHeadersGenerator.test.js
Outdated
Show resolved
Hide resolved
src/public/modules/forms/helpers/csv-response-classes/ArrayAnswerResponse.class.ts
Outdated
Show resolved
Hide resolved
src/public/modules/forms/helpers/csv-response-classes/Response.class.ts
Outdated
Show resolved
Hide resolved
src/public/modules/forms/helpers/csv-response-classes/SingleAnswerResponse.class.ts
Outdated
Show resolved
Hide resolved
src/public/modules/forms/helpers/csv-response-classes/TableResponse.class.ts
Outdated
Show resolved
Hide resolved
src/public/modules/forms/services/submissions.client.factory.js
Outdated
Show resolved
Hide resolved
src/public/modules/forms/services/submissions.client.factory.js
Outdated
Show resolved
Hide resolved
tests/unit/frontend/forms/helpers/CsvMergedHeadersGenerator.test.js
Outdated
Show resolved
Hide resolved
Can we also add more test cases with the additional response type checks? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm but wait for @mantariksh's approval too
Problem
This PR converts the
CsvMergedHeadersGenerator
to typescript.Closes #2030
Solution
Apart from converting the
CsvMergedHeadersGenerator
class to typescript, the response classes incsv-response-classes
were also converted to typescript. Also, theResponse
class was converted to an abstract class, which cannot be instantiated. All subclass will have to implement the functionsgetAnswer
andnumCols
. This was done as the existing implementation inCsvMergedHeadersGenerator
implies the need for all subclasses ofResponse
to have the two aforementioned functions.Manual Tests
TableResponse
), a checkbox field (to checkArrayAnswerResponse
) and an email field (to checkSingleAnswerResponse
). Submit a few responses and download the csv. Ensure that all answers to each form field are present in the csv and the metadata headers are also present.