Hello,
I'm new to Racket, and to gain facility with it I have been trying to write small webapps, i.e. a simple calculator, using the built-in web framework. However, I have found myself stuck when trying to implement tests for some of the functions the webapp provides-- I am not sure how to test functions that process a request. Specifically, I'm trying to write tests for an "process-request" function which turns a request into a Calculator struct. I'm confused if this is one of the unlikely scenarios in which a request struct needs to be made, or if there is a better way to generate a request with certain bindings.
If a request struct does need to be made, can I just place an arbitrary instance of the required data type in each field (except for bindings/raw-promise)? I can just place a list of binding:form in the bindings/raw-promise field, right?
I apologize if I missed something obvious or this is an obnoxious noob question.
Some information that may or may not be helpful:
- Racket experience so far: completed HTDP, webapp tutorial.
- Sources consulted so far:
- Racket documentation on HTTP, formlets, testing servlets, rackunit, contracts, and delayed evaluation.
- Racket webapps hosted on github (I couldn't find any that had used tests)
Thank you.